Created
May 16, 2015 08:11
-
-
Save SaadArdati/74ac4f9228cd8001bcdc to your computer and use it in GitHub Desktop.
Twitter Validater Fixed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean twitterAccountIsValid(String username) { | |
try { | |
URL u = new URL("https://www.twitter.com/" + username.replace("@", "")); | |
HttpURLConnection huc = (HttpURLConnection) u.openConnection(); | |
huc.setRequestMethod("HEAD"); | |
huc.connect(); | |
return huc.getResponseCode() == 200; | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment