Jump to content

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;

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.