I want the user to enter a username and prees 'check'. Then the system will check the availability of theusername in different 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