saurabh saurabh - 1 year ago 142
PHP Question

Recv failure: Connection was reset in Curl PHP

I want to fetch some data from this ip address using http post by xml
I create curl php code for that

$url = "";
$post_string = '<?xml version="1.0"?>
<Header ImmediateResponseRequired="true" OriginalBodyRequested="true">
<Operation Operand="Request" Data="PlayerProfile" />
$header = "POST HTTP/1.0 \r\n";
$header .= "Content-type: text/xml \r\n";
$header .= "Content-length: ".strlen($post_string)." \r\n";
$header .= "Content-transfer-encoding: text \r\n";
$header .= "Connection: close \r\n\r\n";
$header .= $post_string;
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_URL,$url);
//$fp = fopen('rss.xml', 'w');
curl_setopt($ch,CURLOPT_PORT, 8085);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);
echo $data = curl_exec($ch);
print curl_error($ch);

When I hit that link from "`/members/check.php" this url this gives me Recv failure: Connection was reset in Curl this message

And from my localhost I got Failed to connect

php version is also >5.3

I am beginner in Curl please help out for that issue

Answer Source
curl_setopt($ch, CURLOPT_URL, trim($url));
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

For Recv failure: Connection was reset in Curl PHP ==> Declare like this :


& make sure that you are using PHP version >5.3