I’m designing an application that will benefit from having the user’s Facebook friends suggested to them as they type. The difficulty I’m having is turning the Open Graph result (when accessing a users friends through graph.facebook.com/me) into the format that is required by the AutoSuggest jQuery plugin.
I know I can decode this JSON result into an array by using $user = json_decode(file_get_contents($graph_url)); but I’m not experienced enough with PHP to then access parts of this array and put it into the below format.
Format required: ["First Friend","Second Friend","Third Friend"]
Current format: ( [data] => Array ( [0] => ( [name] => Ryan Brodie [id] => 740079895 ) ) [paging] => ( [next] => https://graph.facebook.com/me/friends?access_token=ACCESS_TOKEN&limit=5000&offset=5000&__after_id=USERID ) )
Thank’s in advance for your help.
Zombat’s answer is almost correct