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

  • SEARCH
  • Home
  • 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 9278309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T17:20:03+00:00 2026-06-18T17:20:03+00:00

I am using Facebook open graph as json feed format to get the page

  • 0

I am using Facebook open graph as json feed format to get the page name after I provide an access token in the URL.

here is my code:

$get_pages = file_get_contents("https://graph.facebook.com/me/accounts?access_token=".$_POST['access_token']);
$get_pages = json_decode($get_pages);

foreach($get_pages->data as $page){
    echo $page[name];
    }

I am trying to echo the name of the pages. The Json code that Facebook provide looks like this:

 {
       "data": [
          {
             "category": "website",
             "name": "jjj",
             "access_token": "jjj",
             "id": "jjj",
             "perms": [
                "jjj",
                "jjj",
                "jjj",
                "jjj",
                "jjj",
                "jjj"
             ]
          },
          {
             "category": "Community",
             "name": "ggg",
             "access_token": "ggg",
             "id": "ggg",
             "perms": [
                "ggg",
                "ggg",
                "ggg",
                "ggg",
                "ggg",
                "ggg"
             ]
          }
],
   "paging": {
      "next": "hhh"
   }
}

I am getting this error:

    catchable fatal error: object of class stdclass could not be converted to string in
with this line of code :$get_pages = json_decode($get_pages);

what am I doing wrong here ?

  • 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-06-18T17:20:04+00:00Added an answer on June 18, 2026 at 5:20 pm

    I solved it 🙂 I changed my code to this:

    $get_pages = file_get_contents("https://graph.facebook.com/me/accounts?access_token=".$_POST['access_token']);
    $get_pages = json_decode($get_pages, TRUE);
    echo '<select id="select_page">';
    foreach($get_pages[data] as $page_name){
    echo '<option>'.$page_name[name].'</option>';
    }
    echo '</select>';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I just define my custom action on facebook using open graph. After creating
when I make the user/feed request on the Facebook Open Graph API, I get
I'm able to post an open graph action to facebook using the following url:
I am doing some integration with Facebook Open Graph using their oAuth flow and
I'm using facebook open graph to make a custom action like this: UserName is
I'm developing a facebook canvas application (iframe) and I'm using the Open Graph API
I'm using the Facebook open graph protocol on several pages on my site. I
I tried to grab my Facebook ID using open graph API. It is working
I am using facebook php sdk. And i have integrated facebook open graph on
is there a way to delete a friend using the facebook open graph api?

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.