Freelance Web Developer

Say Hi

Sep 29, 2011

Fetch Google Plus Profile Picture using PHP

Google plus APIs are out now, you can fetch profile images or avatar using that too. But I am here to show you how you can fetch google plus profile image without using their API. Simple and short, and no call limit.

Profile URL schema

Before launching the Google plus, Google's user profiles URL schema was something like this, For example my Google profile link was or

On Google Plus its

Profile Image URL schema

Ok lets talk about profile image, You can get a profile image by ID (or mail ID too) here is the url, mine is
Note: This is not the permalink to profile picture, this will redirect you.

Using PHP to get Picture URL

Its simple with PHP, we are just fetching where its redirecting us, we are going to use a old trick, here is the code:

$headers = get_headers("".$id, 1);
$PicUrl = $headers['Location'];

You can use it for mail id like this

$email                  =      "";
list($id, $domain) = split("@",$email);
$headers = get_headers("".$id, 1);
$PicUrl = $headers['Location'];

You can Discussion and Commets on Google plus

Labels: , , , ,

By :