开发者

Parse Facebook API data using loop for getting fan page ID#s?

开发者 https://www.devze.com 2023-02-02 12:53 出处:网络
I\'ve been learning how to parse json data returned from the facebook->api. I\'ve figured out how to fetch fan pages from a specific profile id and want to parse them using a loop!

I've been learning how to parse json data returned from the facebook->api. I've figured out how to fetch fan pages from a specific profile id and want to parse them using a loop!

Heres the code and example I have below:

This is the dat开发者_如何学JAVAa I get back from the facebook->api

Array ( [0] => Array ( 
[page_id] => XXXXXX60828 ) [1] => Array ( 
[page_id] => XXXXXX0750 ) [2] => Array ( 
[page_id] => XXXXXX91225 ) [3] => Array ( 
[page_id] => XXXXXX1960343 ) [4] => Array ( 
[page_id] => XXXXXX60863 ) [5] => Array ( 
[page_id] => XXXXXX8582 ) )

I need to be able to put this data in a loop and extract the page_id#s out... still getting familiar with json and am having issues figuring this out?

How can I get this in a loop using for each and strip out the page id#s?


Why not just use the array you've got:

<ul>
<?php
foreach($pages as $k=>$v) {
    echo "<li>page id#: $v['page_id'] </li>";
}
?>
</ul>
0

精彩评论

暂无评论...
验证码 换一张
取 消