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 8643807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:08:32+00:00 2026-06-12T12:08:32+00:00

How can I parse this FB account info with PHP and foreach loop? I’m

  • 0

How can I parse this FB account info with PHP and foreach loop? I’m using this code to get user pages:

$user_profile = $facebook->api('/me/accounts');

print_r($user_profile["data"]); 

Here is the resulting array, im trying to get the name and id:

Array
( 
  [0] => Array
  ( 
    [name] => RodBull 
    [access_token] => XXXXXXX
    [category] => Company 
    [id] => 101332379991045 
    [perms] => Array ( 
    [0] => ADMINISTER 
    [1] => EDIT_PROFILE 
    [2] => CREATE_CONTENT 
    [3] => MODERATE_CONTENT 
    [4] => CREATE_ADS 
    [5] => BASIC_ADMIN )
  ) 
  [1] => Array
  ( 
    [name] => Jobyer 
    [access_token] => XXXXXX
    [category] => Cause 
    [id] => 177780562324865 
    [perms] => Array ( 
    [0] => ADMINISTER 
    [1] => EDIT_PROFILE 
    [2] => CREATE_CONTENT 
    [3] => MODERATE_CONTENT 
    [4] => CREATE_ADS 
    [5] => BASIC_ADMIN )
  ) 
  [2] => Array
  ( 
    [name] => Testing it 
    [access_token] => XXXXXXX 
    [category] => Education 
    [id] => 338949122821475 
    [perms] => Array ( 
    [0] => ADMINISTER 
    [1] => EDIT_PROFILE 
    [2] => CREATE_CONTENT 
    [3] =>` MODERATE_CONTENT 
    [4] => CREATE_ADS 
    [5] => BASIC_ADMIN )
  ) 
  [3] => Array
  ( 
    [name] => Wellness Incentives Plus 
    [access_token] => XXXXXX
    [category] => Consulting/business services 
    [id] => 280634342048932 
    [perms] => Array ( 
    [0] => ADMINISTER 
    [1] => EDIT_PROFILE 
    [2] => CREATE_CONTENT 
    [3] => MODERATE_CONTENT 
    [4] => CREATE_ADS 
    [5] => BASIC_ADMIN )
  ) 
  [4] => Array
  ( 
    [name] => Cashierr 
    [access_token] => XXXXXX
    [category] => Community organization 
    [id] => 131516906950255 
    [perms] => Array ( 
    [0] => ADMINISTER 
    [1] => EDIT_PROFILE 
    [2] => CREATE_CONTENT 
    [3] => MODERATE_CONTENT 
    [4] => CREATE_ADS 
    [5] => BASIC_ADMIN )
  ) 
  [5] => Array
  ( 
    [name] => 100x35.me 
    [access_token] => XXXXXX
    [category] => Community organization 
    [id] => 297550586926613 
    [perms] => Array ( 
    [0] => ADMINISTER 
    [1] => EDIT_PROFILE 
    [2] => CREATE_CONTENT 
    [3] => MODERATE_CONTENT 
    [4] => CREATE_ADS 
    [5] => BASIC_ADMIN )
  ) 
  [6] => Array
  ( 
    [name] => Faaafavdsfsd 
    [access_token] => XXXXXX
    [category] => Cause 
    [id] => 336675629760824 
    [perms] => Array ( 
    [0] => ADMINISTER 
    [1] => EDIT_PROFILE 
    [2] => CREATE_CONTENT 
    [3] => MODERATE_CONTENT 
    [4] => CREATE_ADS 
    [5] => BASIC_ADMIN )
  ) 
  [7] => Array
  ( 
    [name] => The Page App Tab by Santu 
    [access_token] => XXXXXXX
    [category] => Application 
    [id] => 402022163198499
  ) 
  [8] => Array
  ( 
    [name] => Button blog 
    [access_token] => XXXXXXXX
    [category] => Application 
    [id] => 194345950699984
  ) 
  [9] => Array
  ( 
    [name] => Twit 
    [access_token] => XXXXXX
    [category] => Application 
    [id] => 473412539337463
  ) 
  [10] => Array
  ( 
    [name] => Invite Friends 
    [access_token] => XXXXXX
    [category] => Application 
    [id] => 112138232257401
  ) 
  [11] => Array
  ( 
    [name] => Candygirl19 
    [access_token] => XXXXXXX
    [category] => Application 
    [id] => 458913407468223
  ) 
  [12] => Array
  ( 
    [name] => Dokter Winkel 
    [access_token] => XXXXXXX
    [category] => Application 
    [id] => 214744621969104
  ) 
  [13] => Array
  ( 
    [name] => Testin James 
    [access_token] => XXXXXXX
    [category] => Application 
    [id] => 186137041506535
  ) 
  [14] => Array
  ( 
    [name] => Fans Avenue 
    [access_token] => XXXXXX
    [category] => Application 
    [id] => 129009763896253
  ) 
  [15] => Array
  ( 
    [name] => Automotive 
    [access_token] => XXXXXXX
    [category] => Application 
    [id] => 304776169593014
  ) 
  [16] => Array
  ( 
    [name] => Dealers 
    [access_token] => XXXXXX
    [category] => Application 
    [id] => 267196013320187
  ) 
  [17] => Array
  ( 
    [name] => Empleo 
    [access_token] => XXXXXX
    [category] => Application 
    [id] => 110682139041185
  ) 
  [18] => Array
  ( 
    [name] => Free Account 
    [access_token] => XXXXXXXX
    [category] => Application 
    [id] => 227897480601648
  ) 
  [19] => Array
  ( 
    [name] => Bienes Raices 
    [access_token] => XXXXXXX
    [category] => Application 
    [id] => 255317971171412
  ) 
  [20] => Array
  ( 
    [name] => Autos 
    [access_token] => XXXXXX
    [category] => Application 
    [id] => 276616169025835
  )
)
  • 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-12T12:08:33+00:00Added an answer on June 12, 2026 at 12:08 pm
    <?php
      $user_profile = $facebook->api('/me/accounts');
      foreach ($user_profile["data"] as $profile){
        $name = $profile["name"];
        $id = $profile["id"];
        echo "Name is $name and id is $id <br />";
      }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can not parse json using this var res = eval('(' + response + ')');
I can't figure out why I get this error: Parse error: syntax error, unexpected
How can i parse this XML with C# WP7 to different lists for binding
Is there any tool that can parse/conver xml files to this format? I have
How can I parse URL queries with a system like this. For Example something
This is only tangentially a programming question. Where can I find a simple-to-parse list
can't seem to get this parser to work for google maps, I think its
How i can parse and extract the parameters from an SQL Query using delphi?
How can I parse this data to use it: I am getting below data
I am getting this error Parse error : syntax error, unexpected T_STRING in /ho.../ssd/recording-goodbye.php

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.