Welcome Guest, Not a member yet? Register   Sign In
Error using XMLRPC, CURL and file_get_contents

We are having a problem getting a reliable response from the domain in CURL or File_Get_Contents below which uses CI to query a database.

More often than not it returns a error 52, or using file_get_contents a HTTP failed message.

If we switch the domain to the commented out code, it will load the page and pass it through curl / fgc. It is only when it has to go through CI's URL that there is a problem, sometimes it works but most of the time it doesn't

$code = 26003;
$curl = curl_init();  
curl_setopt($curl, CURLOPT_VERBOSE, true);

curl_setopt($curl, CURLOPT_URL, 'http://mydomain.com/service.php/curlapi/getcode/'.$code);  
// curl_setopt($curl, CURLOPT_URL, 'http://mydomain.com/');  
//curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
curl_setopt($curl, CURLOPT_HEADER, 0);  // ignore any headers

curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);

$store = curl_exec($curl);
print "<pre>";
print $store;
echo "\n\ncURL error number:" .curl_errno($curl);
// print error info
echo "\n\ncURL error:" . curl_error($curl);
print "</pre>";

Theme © iAndrew 2016 - Forum software by © MyBB