Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if some email address register at gravatar?

How can I just return false or true if email address is register at gravatar with php? Tnx

like image 530
user147 Avatar asked Nov 02 '10 09:11

user147


2 Answers

I think it can be useful : http://codex.wordpress.org/Using_Gravatars#Checking_for_the_Existence_of_a_Gravatar

like image 189
MatTheCat Avatar answered Sep 28 '22 13:09

MatTheCat


Request the gravatar with a query parameter of d=404 (default to 404)

https://www.gravatar.com/avatar/nogravatarexistsforthisemailhash?d=404

This will return a 404 if the email does not have a registered gravatar. If one does exist, the image is returned with a 200.

So make the request, then map a 200 response to true, 404 response to false.

like image 26
davnicwil Avatar answered Sep 28 '22 15:09

davnicwil