我使用picasaweb(谷歌)API通过电子邮件地址获取个人资料照片..
我从网址获取输出:
http://picasaweb.google.com/data/entry/api/user/adircohen@gmail.com?alt=json
如何获取包含内容的变量:
https://lh3.googleusercontent.com/-9GSeL43L-A4/AAAAAAAAAAI/AAAAAAAAAAA/x8Uy6PTaS1o/s64-c/112285456748585606724.jpg
我试过这个,但它没有用:
$json = file_get_contents('http://picasaweb.google.com/data/entry/api/user/adircohen@gmail.com?alt=json');
$obj = json_decode($json);
echo $obj->gphoto->$thumbnail;
答案 0 :(得分:-2)
使用此函数从URL获取内容file_get_contents();
$page = file_get_contents("http://picasaweb.google.com/data/entry/api/user/adircohen@gmail.com?alt=json");
$ap = json_decode($page); // decode the json record
$ap = (array)$ap->entry; // convert object to array for further process
$ap = (array)$ap['gphoto$thumbnail']; // convert object to array for
获得精确输出为图片网址
echo $ap['$t']; // display the output