Me encuentro haciendo una petición en curl en cuyo caso funciona de maravilla en postman sin embargo el problema empieza cuando la quiero hacer en php
Resultado en Postman:
POST/GET url: http://xxxxxxxxxxxx/post/read.php?acct_num=xxxxxxxxxxx
Current Response is:
{"Numero de Cuenta":"xxxxxxxxx","Casa":"xxxxxxxxxxxxx ","Apertura":"xxx-xx-xx","Fecha Ult Compra":"xxxx-xx-xx"}
pero cuando la hago en curl todo falla Peticion en curl:
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_HTTPHEADER => array(
'Accept-Encoding: application/json'
),
//CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true
));
$response = curl_exec($curl);
curl_close($curl);
$fresp = print_r(json_decode($response));
$error = json_last_error();
var_dump($json, $error === JSON_ERROR_UTF8);
fwrite($guardame, $fresp . PHP_EOL);//Mi Metodo un poco tonto de loggear errores
fwrite($guardame, $error . PHP_EOL);
Mi archivo de log:
http://xxxxxxxxxx/post/read.php?acct_num=xxxxxxxxxxx
1
0
Sin embargo si no uso json_decode
el resultado es igual al de postman
he gastado bastante tiempo buscando pero parece que no lo hago correctamente le importaría a alguien proveer alguna pista?