Check if some email address register at gravatar?
How can I just return false or true if email address is register at gravatar with p开发者_如何学JAVAhp? Tnx
I think it can be useful : http://codex.wordpress.org/Using_Gravatars#Checking_for_the_Existence_of_a_Gravatar
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.
The way I've seen it done with other image-based on-line checks such as Skype status is to compare the file sizes of the off-line image and the on-line image.
In the case of gravatar, you could check the size of the default gravatar image then compare that the gravatar of the email address you're attempting to verify. Not fool-proof, but better than nothing.
Give this a Google. I'm not sure if gravatar have an API or not.
EDIT: Or you can check the response headers as above. Good shout!
精彩评论