Question
Problem with Curl or Json (Debian 7.2, PHP 5.5 e etc)
Hi, I have a site that is running Opencart and makes payment for the Paybras, testing locally worked 100%, but in Digital Ocean Json return of payment is always null.
The Firewall is empty and already installed Curl and Json, etc-http://162.243.88.70/info.php.
The code used is as follows:
$ch = curl_init ($url);
$data _ string = json_encode ($data);
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt ($ch, CURLOPT_POSTFIELDS, $data _ string);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_HTTPHEADER, array (
' Content-Type: application/json ',
' Content-Length: '. strlen ($data _ string))
);
$resultado = curl_exec ($ch);
curl_close ($ch);
return $resultado;
Log data:
It returns the following steps:
2/3/2014 13:44:04-Paybras = 1 validation
2/3/2014 13:44:04-Calling the Curl Paybras
2/3/2014 13:44:05-Return the Json (wave)
2/3/2014 13:44:05-if non-success
Being the return of Json (Curl) was to return a variable of success, but as the return is empty does not return anything.
The Curl is running normal with other mode of payment, so that's not a problem with him.
The function is called by Ajax Post type and Json data and before you go to the Log data is converted into PHP with json_decode and only after I test the Log.
Does anyone have any idea what can be the problem?
Add a comment
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×