在Graph API > Photo中,我使用以下脚本来获取Photo属性
$response = file_get_contents($token_url);
if($response=='') { echo "<script>window.location='index.php'</script>"; }
$params = null;
parse_str($response, $params);
$fb_photo_id='10150361640936173';
$graph_url_photos = "https://graph.facebook.com/" . $fb_photo_id . "?access_token="
. $params['access_token'];
$photos = json_decode(file_get_contents($graph_url_photos));
}
("token " . $params['access_token']);
echo $photos_id=$photos->id; echo "</br>";问:如何获取$photos->tags的数据?
发布于 2011-11-20 05:54:29
下面是访问它的方式:
<?php
// ... your code here...
if(!empty($photos->tags)) {
foreach($photos->tags->data as $tag)
echo "ID: {$tag->id}<br />Name: {$tag->name}<br />X: {$tag->x}<br />Y: {$tag->y}<br />Created on: {$tag->created_time}<br /><br />";
}发布于 2011-11-20 04:43:22
您可以使用此页面测试Graph API调用:https://developers.facebook.com/tools/explorer
对于您的示例:https://developers.facebook.com/tools/explorer?method=GET&path=10150361640936173
你会看到“标签”结构是这样的:
"tags": {
"data": [
{
"id": "1696691267",
"name": "黃柏淇",
"x": 64.375,
"y": 80.2619,
"created_time": "2011-11-07T09:12:22+0000"
},
{
"id": "1705329218",
"name": "Austin Ng",
"x": 80.4543,
"y": 48.0512,
"created_time": "2011-11-07T09:12:22+0000"
}
]
}, https://stackoverflow.com/questions/8196145
复制相似问题