1

I'm using picasaweb(google) API to get the profile picture by email address..

I get the output from the URL:

http://picasaweb.google.com/data/entry/api/user/adircohen@gmail.com?alt=json

How can I get the variable with the content:

https://lh3.googleusercontent.com/-9GSeL43L-A4/AAAAAAAAAAI/AAAAAAAAAAA/x8Uy6PTaS1o/s64-c/112285456748585606724.jpg

I've tried this, but it's not working:

$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;
Adir Cohen
  • 19
  • 1
  • 6

1 Answers1

-1

Getting content from URL using this function 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 

getting exact output as image url

echo $ap['$t']; // display the output
  • 2
    How many times will you need to be told that s ***good answer*** will always have an explanation of what was done and why it was done in such a manner, not only for the OP but for future visitors to SO? – Jay Blanchard Apr 17 '17 at 14:20
  • Please read http://stackoverflow.com/help/how-to-answer – Jay Blanchard Apr 17 '17 at 14:22