<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class OvumCaption {
    
    public function caption($email) {
        
        $ch = curl_init();
        //Chaves de acesso  API enviadas via POST
        $post = array(
            'token' => CAPT_TOKEN,
            'chave' => CAPT_CHAVE,
            'email' => $email
        );
        
        
        $url = CAPT_URL; 
        
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $requisicao = curl_exec($ch);
        
        $resposta_decodificada = json_decode($requisicao);
        
        curl_close($ch);
        
        return $resposta_decodificada;
    }
}
