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://184.108.40.206/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?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Click below to sign up and get $200 of credit to try our products over 60 days!
Seems like a php problem. Try adding <code>error_reporting(-1);ini_set(‘display_errors’, 1);</code> at the top of your file, does that make it output any errors? <br> <br>Do you have the curl extension installed? <pre>sudo apt-get install php5-curl</pre>
I vaguely remember whether json has some issue with php5.x.x because just today I had to upgrade my php to the latest versions php5.5.8 to avoid a lot of issues including json… <br> <br>try to update it then see whether the error persist or not…