tags:

views:

90

answers:

1

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 too difficult. Have you got some ideas?

+1  A: 

I'm going to guess that either curl isn't installed on your server and/or error reporting is disabled / turned down on your server.

Edit: Okay, if you know curl is installed and works, you still need to enable error reporting. When you finally see your error about "certificate verify failed," you'll need to export a X.509 Certificate (PEM) from Facebook and configure curl to trust it.

Or, if this isn't production code, you can just use (the insanely insecure):

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

... to blindly accept Certificate Authorities.

Dolph
curl works in this server, it doesnt work with facebook...
monthon1