Weird behavior of curl and facebook
- by monthon1
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?