开发者

Check if some email address register at gravatar?

开发者 https://www.devze.com 2023-01-22 20:50 出处:网络
How can I just return false or true if email address is register at gravatar with p开发者_如何学JAVAhp?

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!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号