开发者

how to check the availability of a username in a social network?

开发者 https://www.devze.com 2023-02-18 16:02 出处:网络
I want the user to enter a username and prees \'check\'. Then the system will check the availability of theusername in differ开发者_Go百科ent social networks.

I want the user to enter a username and prees 'check'. Then the system will check the availability of theusername in differ开发者_Go百科ent social networks.

My question is: Can I have a common method/function for all networks? Or each network has its way to let programmers check the username availability?

If it is the second case, can anyone give an example of the function that checks the username (for any social network)?


There isn't a common interface for all social networks, some offer API's to check for username availablity, some don't offer it at all and with others you can check if the userpage returns a 200 HTTP header status to find out if it exists.

Your best bet is to list all the social networks you want to check and then look for a PHP script they offer to communicate with their API.

For example: you can use the any of the numerous PHP Twitter libraries to look up if a username exists: http://developer.twitter.com/pages/libraries#php


I think each network have its method for security reason, as example facebook will not let you in except with his own api. Facebook authentication.

If it is the second case, can anyone give an example of the function that checks the username (for any social network)?

I don't think this functionality exist because social networks doesn't provide directly instead you can simulate it by sending a request to create an account, if they doesn't accept it that is mean such user exist, better to use curl.

0

精彩评论

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