Question

This is a problem am facing for long now also asked a question regarding this before but didn’t get it solved, but by now I’ve refine my case, for the latest the case is:

I am trying retrieving username, emailing and publishing photos from the code through graph api, the code was working fine when It was on some other server but recently I moved the application to phpfog and since then am facing this weird problem.

As it seems the problem is only with the information and functions where where access token is required (full name, email, publishing photos) other information such as profile picture etc. can still easily be retrieved.

The same code works perfectly fine on other server but as soon as I bring it phpfog it stop working in this weird way.

Is there a need to refresh access_token if yes, how can I do that?

try {
                $userId = $_POST["user_id"];
                $oauth_token = $_POST["oauth_token"];

                $userName =   json_decode(file_get_contents('https://graph.facebook.com/' . $userId)) -> name;
                $userGender =   json_decode(file_get_contents('http://graph.facebook.com/' . $userId)) -> gender;
                $userPpicture =   json_decode(file_get_contents('http://graph.facebook.com/' . $userId)) -> picture;
            } catch(Exception $e) {
                echo $e -> getMessage();
                echo "<br>";
            }

Kindly get me through this. Thankyou.

Was it helpful?

Solution

After consulting phpfog support i came to know that their shared hosting plan doesnot support the function file_get_contents.

Anyone of their dedicated plans will be able to run the commands which are restricted on their shared service.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top