xenophobia Posted August 4, 2008 Share Posted August 4, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/118046-solved-curl-having-some-tricky-problems/ Share on other sites More sharing options...
ratcateme Posted August 4, 2008 Share Posted August 4, 2008 i am not sure how your cURL handles redirects when i run your code i get an error page telling me google has moved to google.co.nz try setting this curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, 1); Scott. Quote Link to comment https://forums.phpfreaks.com/topic/118046-solved-curl-having-some-tricky-problems/#findComment-607275 Share on other sites More sharing options...
xenophobia Posted August 4, 2008 Author Share Posted August 4, 2008 Same... ??? Quote Link to comment https://forums.phpfreaks.com/topic/118046-solved-curl-having-some-tricky-problems/#findComment-607294 Share on other sites More sharing options...
Jenski Posted August 4, 2008 Share Posted August 4, 2008 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; Quote Link to comment https://forums.phpfreaks.com/topic/118046-solved-curl-having-some-tricky-problems/#findComment-607422 Share on other sites More sharing options...
xenophobia Posted August 12, 2008 Author Share Posted August 12, 2008 You are right!!! I had a proxy server. After adding the statement, everything work fine! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/118046-solved-curl-having-some-tricky-problems/#findComment-614151 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.