I am trying to get facebook access token
But the url when executed from browser and local machine php script returns true data values. However, when i run the same script from server, it fails and shows bool(false)
the url
$token_url = "https://graph.facebook.com/oauth/access_token?"
. "client_id=".$config['appId']."&redirect_uri=" . urlencode($config['callback_url'])
. "&client_secret=".$config['secret']."&code=" . $_GET['code'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $token_url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$response = curl_exec ($ch);
var_dump($response);
Other urls work on the server.
What is wrong here ?
I have been given to understand from an upvoted answer on one of the other questions that my server Hostinger (free) does not allow connecting to Facebook SDK !!!
I am moving to a paid server !
Try to check curl_error
That may help finding what was wrong .
You should check at the curl error instead of only looking at the curl_exec result:
Try this:
UPDATE
Try setting this:
For more details check here