PHP echo out multidimensional array from facebook var -
i have facebook array , trying echo out names , id.
all have array: $friends_list.
when use code:
print_r($friends_list);
then following comes out below: how loop thru these? or if wanted find out how many names there or call on 1 var id. in short how echo out $friends_list multid array?
array ( [data] => array ( [0] => array ( [name] => wendy cukierski [id] => 524320383 ) [1] => array ( [name] => leticia mercado correa [id] => 537763225 ) [2] => array ( [name] => olivia urbina [id] => 538711855 ) [3] => array ( [name] => ruth albrecht [id] => 541610111 ) [4] => array ( [name] => josh brahm [id] => 577546485 ) [5] => array ( [name] => kim yu [id] => 583515871 ) [6] => array ( [name] => sistertracey dugas [id] => 643567171 ) [97] => array ( [name] => mary martinez [id] => 100004696266210 ) ) [paging] => array ( [next] => https://graph.facebook.com/1566027944/friends?limit=5000&offset=5000&__after_id=100004696266210 ) )
duplicate --> how store facebook user's friends list in mysql using php?
$friends_list = file_get_contents('https://graph.facebook.com/me/friends?access_token=' . $atoken ); $friends_list_array = json_decode($friends_list,true); $arr= $friends_list_array['data']; $friend_ids_arr = array(); foreach($arr $friend) { $friend_ids_arr[] = $friend['id']; } $friend_ids = implode("," , $friend_ids_arr); echo $friend_ids; // output: id1,id2,id3...etc
Comments
Post a Comment