3

I have a script on my shared web hosting and i want to do curl calls along with proxies. here is my script

<?php

$ch = curl_init("http://dynupdate.no-ip.com/ip.php");

curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_PROXY, "187.20.30.97:8080");
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type:application/x-www-form-urlencoded"));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; GTB7.4; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.2)"); 
curl_setopt($ch, CURLOPT_COOKIE, "auth=somevaluehere");
$x = curl_exec($ch);    

print "page:" . htmlentities($x) . curl_error($ch) ;

curl_close($ch);

?>

But it keep loading for ages then shows error : couldn't connect to host.

But if i didn't use proxies it will load immediately.

I have got two shared hostings one on godaddy and one on another cheap web hosting and both didn't work. i think it is a server side configuration that deny the using of proxies?

EDIT : I figured out that the server is running in Safe Mode.

4

0 回答 0