For the past 2 days I’ve been struggling trying to successfully authenticate users into my Facebook app. What I want to achieve in the end is to retrieve and store the access token of an user.
The problem I have comes by following the FB tutorial for authentication: http://developers.facebook.com/docs/authentication/
Just above the Client-side Flow section there is a snippet of code which should allow me to get the current user. Unfortunately, I only get an error:
Warning: file_get_contents(https://graph.facebook.com/me?access_token=) [function.file-get-contents]: failed to open stream: No route to host
Traced the error back to the point I can, and apparently there is an error on this line:
$response = @file_get_contents($token_url);
because if I echo the $response, I get nothing.
What is there not mentioned in the tutorial that I should be doing but I’m not because I have no idea I should do it?
Many thanks
Well, it got sorted in the end. Apparently it’s a server problem. I tried developing the app on 2 different servers + locally (EasyPhp 5.3.8.1). On the 3rd server I tried it works for now (fingers crossed). Honestly, I have no idea why it’s working now and why my local server didn’t function as it should have. Well, it works for now 😀