Weird behavior of curl and facebook

Posted by monthon1 on Stack Overflow See other posts from Stack Overflow or by monthon1
Published on 2010-05-13T22:34:24Z Indexed on 2010/05/13 22:44 UTC
Read the original article Hit count: 231

Filed under:
|
|

Here is the code:

$ch = curl_init( 'https://graph.facebook.com/btaylor');

curl_setopt( $ch, CURLOPT_USERAGENT, '' );

curl_setopt( $ch, CURLOPT_RETURNTRANSFER ,true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 

$data = curl_exec($ch);

print_r( $data) ;
curl_close($ch);

It shows few informations from facebook. It works on my localhost, but when I try to run it on my server it just doesn't work, returns a blank site. I tried to use this code with others sites like example.com and It works, so I thought, that its becouse of facebook blocks my ip (i dont know why it would be true), so I checked it. I have run it with

curl_setopt($ch, CURLOPT_PROXY, 'myproxy');

But it still doesn't show any information. I am trying to fix it all day, but its to difficult. Have you got some ideas?

© Stack Overflow or respective owner

Related posts about php

Related posts about curl