Hi using graph API i am able to get the photos of my albums, now i want to download all the photos in the album to my computer. it returns data in JSon format, how can i filter only the Urls of the images from that json and then download all photos from that url my json is some like this format
{
"data": [
{
"id": "1140894483853",
"from": {
"name": "Muhammad Asghar",
"id": "1272156814"
},
"tags": {
"data": [
{
"id": "1272156814",
"name": "Muhammad Asghar",
"x": 52.6,
"y": 29.538,
"created_time": "2009-08-20T07:46:50+0000"
}
开发者_JAVA技巧 ]
},
"picture": "http://photos-d.ak.fbcdn.net/photos-ak-snc1/v3356/171/103/1272156814/s1272156814_30392128_5890712.jpg",
"source": "http://a4.sphotos.ak.fbcdn.net/photos-ak-snc1/v3356/171/103/1272156814/n1272156814_30392128_5890712.jpg",
"height": 604,
"width": 498,
"images": [
{
"height": 604,
"width": 498,
"source": "http://a4.sphotos.ak.fbcdn.net/photos-ak-snc1/v3356/171/103/1272156814/n1272156814_30392128_5890712.jpg"
},
Please anyone help.
You can use JsonDecode: JsonDecode
assume your json string is in a $data
variable, you can try something like this:
<?php
var_dump( json_decode($data));
?>
if you look at the source code of the page you'll have a pretty clear idea of how the json is structured, and you can easly use a foreach statement to get only the urls you need
精彩评论