ive set the required permissions and gotten the path ie me/photos this displays:
{
"data": [
{
"id": "78768",
"from": {
"name": "Dai beckham",
"id": "135656456"
},
"picture": "link here",
"source": "link here",
"height": 540,
"width": 720,
"images": [
{
"height": 720,
"width": 960,
"source": "link here"
},
i then try echoing the image paths like echo $user_graph['data']['source'];
but im getting an error
"Notice: Undefined index: source in A:file-name.php on line 12"
i have no idea where im going wrong. thanks in advance.
You need to convert the response into an array before you can access it like that.
Currently it's in JSON format. You can use the native json_decode()
function to convert it for you.
$array = json_decode($response, true);
$source = $array['data']['source'];
$array = json_decode($response, true); //it will provide array
$source = $array['data']['source']; and access it now
Simply fetch from this url
http://graph.facebook.com/ankit.varia/picture
type your name instead of mine ankit.varia(me)= (your)