using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace FreeNameLibrary { public class TwitterInterface { protected static string checkerUserAgent = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7"; public static string optimizeNameForTwitter(string name) { name = Tools.purify(name,""); // will change "Willem Middelkoop" into WillemMiddelkoop return name; } public static bool isUsernameAvailable(string username) { string twitterUrl = "http://mobile.twitter.com/" + username; bool isAvailable = false; int responseCode =Tools.getInternetHttpResponseCode(twitterUrl,null,checkerUserAgent); if(responseCode == 404){ isAvailable = true; } return isAvailable; } } }