Jump to content

[SOLVED] CURL having some tricky problems!


xenophobia

Recommended Posts

Hi guys, do you know why these code not functioning??

 

$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'http://www.google.com/');
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl_handle,CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1');
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);

var_dump($buffer);

 

I get boolean(false). I am sure that my curl library are functioning. I m using mozilla firefox 3.0.

PHP5Apache2 server in Windows XP professional platform.

Link to comment
https://forums.phpfreaks.com/topic/118046-solved-curl-having-some-tricky-problems/
Share on other sites

Hi ,

Are you on a network?

I had the same problem, after tearing my hair out I found out it was because I hadn't defined our proxy server e.g.

 

$proxy="<proxy_ip>:<proxy_port_no>";
$ch = curl_init('http://www.google.co.uk/'); // the target
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return the page
$result = curl_exec($ch); // executing the cURL
curl_close($ch); // Closing connection
echo $result;

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.