If you want to validate twitter username using PHP then you can achieve this using CURL.

Following function will check whether twitter username exists or not.

<?php
 function validate_twitter_username($username)
 {
 $twitter_url='http://api.twitter.com/1/users/show/'.$username.'.xml';
 
 $init = curl_init();
 curl_setopt ($init, CURLOPT_URL, $twitter_url);
 curl_setopt ($init, CURLOPT_CONNECTTIMEOUT, 20);
 curl_setopt($init, CURLOPT_NOBODY, 1);
 curl_setopt($init, CURLOPT_HEADER, 1);
 curl_setopt($init, CURLOPT_RETURNTRANSFER, true);
 
 curl_exec($init);
 $result_header = curl_getinfo($init, CURLINFO_HTTP_CODE);
 curl_close($init);
 
	 if( $result_header == "404" )
	 {
	  // IF username not exists return false
	  return false;
	 }else{
	 // IF username exists return true
	  return true;
	 }
 }
 if(validate_twitter_username('snilesh'))
 {
	 echo 'Username Exists.. Please Try Other username';
 }
 else
 {
	 echo 'Username Available';
 }
?>