Hello I need help very urgent ! this is my code $url = 'https://api.libertyreserve.com/xml/balance.aspx'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); if(curl_exec($ch) === false) { echo 'Curl error: ' . curl_error($ch).'|'.curl_errno($ch); } else { echo 'Operation completed without any errors'.curl_errno($ch); } curl_close($ch); PHP: when i run this code, it return an error: Curl error: SSL read: error:00000000:lib(0):func(0):reason(0), errno 0|52 PHP: Can someone please help me to fix this code ??? I try but it did not work Thank you very much
Put the url in the constructor. $ch = curl_init('https://api.libertyreserve.com/xml/balance.aspx'); // discard $url and curl_setopt($ch, CURLOPT_URL, $url); Try set CURLOPT_SSL_VERIFYPEER to FALSE instead of 0. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); Also a user agent may or may not help. curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0"); If all fails, your curl wasn't compiled with openssl.
Hurayyyyy ! Thank you very very very much ! It is working now ! this is code: $ch = curl_init('https://api.libertyreserve.com/xml/balance.aspx'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0"); if(curl_exec($ch) === false) { echo 'Curl error: ' . curl_error($ch).'|'.curl_errno($ch); } else { echo 'Operation completed without any errors'.curl_errno($ch); } curl_close($ch); PHP: