I coded a script that can upload images to fanpage's on facebook, I tried on a webhosting but open_basedir is disabled for "realpath" so I cannot use it (but login, facebook status update and all those things works perfectly). So I tried in a VPS, I installed appserv with Apache 2.2.8 & PHP 5.2.6 but when I try to autenticate with the app i get an error:
Warning: file_get_contents(https://graph.facebook.com/me/accounts?access_token=) [function.file-get-contents]: failed to open stream: No error in C:\AppServ\www\editor_imagenes\index.php on line 58
Warning: Invalid argument supplied for foreach() in C:\AppServ\www\editor_imagenes\index.php on line 79
Warning: file_get_contents(https://graph.facebook.com/me?access_token=) [function.file-get-contents]: failed to open stream: No error in C:\AppServ\www\editor_imagenes\index.php on line 106
I know my code it is ok because when i tried on the webhosting works fine... what i can do? Thanks for reading:)
Problem solved:
I replaced file_get_contents with this:
if(!extension_loaded('curl') && !@dl('curl_php5.so'))
{
return 0;
}
$parseurl = parse_url($token_url);
$c = curl_init();
$opts = array(
CURLOPT_URL => $token_url,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_TIMEOUT => 10,
CURLOPT_HTTPHEADER => array("Host: " . $parseurl['host']),
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_SSL_VERIFYPEER => false
);
curl_setopt_array($c, $opts);
$response = @curl_exec($c);
Thanks for "gladius", he gives me the code.