Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7067493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:12:31+00:00 2026-05-28T05:12:31+00:00

I got given a code from a friend that displayed the app users birth

  • 0

I got given a code from a friend that displayed the app users birth date on the app canvas.

I have tried to change it in order to echo the users own ID. It works for myself (the creator) and it also works for a friend that i have designated as a developer. But for anyone else it brings up this error:

Warning: file_get_contents(https://graph.facebook.com/me?
fields=id&access_token=228073413942115|460d2e1ffd0b4cc6b5cb480d53f60d6e)
[function.file-get-contents]: failed to open stream: HTTP request failed! 
HTTP/1.0 400 Bad Request in /home/robsdmr/public_html/fb/index.php on line 34

The code is as follows.

<?php
require_once("src/facebook.php");

$app_id = "xxxxxxxxxx";
$app_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxx";
$canvas_page = "https://apps.facebook.com/roblewtest/" .$app_id;


$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true,
));

$access_token = $facebook->getAccessToken();


$auth_url = "https://www.facebook.com/dialog/oauth?scope=user_id&client_id="
. $app_id . "&redirect_uri=" . urlencode($canvas_page);

$signed_request = $_REQUEST["signed_request"];

list($encoded_sig, $payload) = explode('.', $signed_request, 2);

$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);

if (empty($data["user_id"])) {
echo("<script> top.location.href='" . $auth_url . "'</script>");
} else {

}

$graph_url = "https://graph.facebook.com/me?fields=id&access_token=" . $access_token;
$result = json_decode(file_get_contents($graph_url));

echo "{$result->id}"

?>

I am pretty new to this so pointers would be great

I have a feeling that it is the scopes that i am not quite to grips with, but i really need this working.

Thanks a lot guys n gals.

R.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:12:31+00:00Added an answer on May 28, 2026 at 5:12 am

    Try using SDK’s graph methtod:

    $result = $facebook->api('/me?fields=id');
    

    And also to get login url you could use:

    $auth_url = $facebook->getLoginUrl();
    

    Documentation:api(), getLoginUrl()

    Also simplified you code, see here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried the following code in LINQPad and got the results given below: List<string>
Given that django-nonrel has got JOINs working, does this mean we have M2M fields
I was given this code a while back. I finally got around to testing
I've got a query that returns the cost of wages for a given member
Say I've got two scheduled processes: A and B. Given that B should not
i got this exception when i done the code given below.. Unable to evaluate
I have got a code snippet as follows: Dim fstream = new filestream(some file
I'm porting some code from lisp, but I got stuck at this part (apparently
I got a error message from ghc that I didn't undesrtand, and reduced my
I've got some code which draws data from an xml file but it seems

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.