Curl Problem: Could not connect to host
Posted: Fri Aug 24, 2007 6:33 am
feyd | Please use
Also the URL is provided here is supposed to return an XML file which is not returning now since the curl could not connect to the host. Again if anyone of you has any alternative way of posting a stream of data without a form beside Curl, please provide me.
Thanx,
Mou
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have written the following code but found the error "Could not connect to host", I am unable to understand why this message is showing. I am giving my code snippet here:Code: Select all
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, "https://24.113.250.119/localvocal/index.aspx");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,0);
$result = curl_exec ($ch);
if (empty($ret))
{
// some kind of an error happened
die(curl_error($ch));
curl_close($ch); // close cURL handler
}
else
{
$info = curl_getinfo($ch);
curl_close($ch); // close cURL handler
if (empty($info['http_code'])) {
die("No HTTP code was returned");
} else {
// load the HTTP codes
$http_codes = parse_ini_file("https://24.113.250.119/localvocal/index.aspx");
echo "The server responded: <br />";
echo $info['http_code'] . " " . $http_codes[$info['http_code']];
}
}Thanx,
Mou
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]