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;
?>
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;
?>