curl doesn't work

Status
Not open for further replies.

userfish.olegs19

New Member
Messages
1
Reaction score
0
Points
0
When I try to use curl it doesn't work, although phpinfo shows that it is installed.
The same script work on my test home machine.
here is a simple script:
<?php

function getPage($url,$post='')
{
$ch = curl_init();

//echo $url;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
if(!empty($post)) curl_setopt ($ch, CURLOPT_POST, 1);
else curl_setopt ($ch, CURLOPT_POST, 0);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 30);

$output = curl_exec($ch);
//echo $output;exit;
if (curl_errno($ch)) {echo "ERROR!!!" + curl_errno($ch);exit;}
curl_close($ch);
return $out;
}

$s=getPage("http://whatismyipaddress.com");

echo $s;
?>
 

garrettroyce

Community Support
Community Support
Messages
5,609
Reaction score
252
Points
63
Unfortunately, due to people creating proxy scripts that are strictly forbidden by the X10 hosting TOS, the outgoing port that CURL uses to fetch remote information is blocked. If you absolutely must use this functionality, you will have to look into upgrading your hosting to one of the premium services. We unfortunately cannot unblock ports for one user.

If you are connecting to a known safe API of some sort, let us know because these shouldn't be disabled.
 
Last edited:
Status
Not open for further replies.
Top