I am trying to retrieve information from Gravatar to my Joomla. I am successful with retrieving my image from gravatar but i am struggling to retrieve other profile information.
$str = file_get_contents('http://www.gravatar.com/205e460b479e2e5b48aec07710c08d50.php' );
$profile = unserialize( $str );
if ( is_array( $profile ) && isset( $profile['entry'] ) )
echo $profile['entry'][0]['displayName'];
?>
The following code was on gravatar documentation, and it only outputs my gravtar name. How to obtain other necessary profile information?! I am little bit new to PHP too.
Thank you.
Sorry, I completely misunderstood your question:-D
Values like IMs, email and phone are available if user himself has set them. Have in mind that $profile['entry'][0]['ims']
is an array with keys stating from zero to array length minus one.
echo $profile['entry'][0]['emails'][0]['value'];
echo $profile['entry'][0]['ims'][0]['value'] ;
echo $profile['entry'][0]['ims'][0]['type'] ;
ims
array is something like this:
["ims"]=>
array(6) {
[0]=>
array(2) {
["type"]=>
string(3) "aim"
["value"]=>
string(10) "checkmeout"
}
[1]=>
array(2) {
["type"]=>
string(3) "msn"
["value"]=>
string(10) "checkmeout"
}
[2]=>
array(2) {
["type"]=>
string(5) "yahoo"
["value"]=>
string(10) "checkmeout"
}
[3]=>
array(2) {
["type"]=>
string(3) "icq"
["value"]=>
string(10) "checkmeout"
}
[4]=>
array(2) {
["type"]=>
string(5) "gtalk"
["value"]=>
string(10) "checkmeout"
}
[5]=>
array(2) {
["type"]=>
string(5) "skype"
["value"]=>
string(10) "checkmeout"
}
}