Advertisement
Guest User

Checker Function

a guest
May 18th, 2017
526
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. Public Function checker(ByVal username As String) As Object
  2. Dim obj As Object
  3. Dim result As Object
  4. Try
  5. Dim httpWebRequest As HttpWebRequest = CType(WebRequest.Create("https://i.instagram.com/accounts/web_create_ajax/"), HttpWebRequest)
  6. Dim s As String = "email=&password=&username=" + username + "&first_name="
  7. Dim bytes As Byte() = Encoding.UTF8.GetBytes(s)
  8. httpWebRequest.Method = "POST"
  9. httpWebRequest.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"
  10. httpWebRequest.UserAgent = "Instagram 8.2.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)"
  11. httpWebRequest.Headers.Add("X-CSRFToken", "pmVVrIms8Du1cV0Lo5iPFmMGZCEBz8KI")
  12. httpWebRequest.Headers.Add("X-Instagram-AJAX", "1")
  13. httpWebRequest.Headers.Add("Accept-Encoding: gzip, deflate")
  14. httpWebRequest.Headers.Add("Accept-Language: ar-SA;q=1, en-SA;q=0.9")
  15. httpWebRequest.Headers.Add("Accept: */*")
  16. httpWebRequest.Headers.Add("X-Requested-With", "XMLHttpRequest")
  17. httpWebRequest.Referer = "https://i.instagram.com/accounts/login/ajax/"
  18. httpWebRequest.ContentLength = CLng(bytes.Length)
  19. Dim requestStream As Stream = httpWebRequest.GetRequestStream()
  20. requestStream.Write(bytes, 0, bytes.Length)
  21. requestStream.Close()
  22. Dim httpWebResponse As HttpWebResponse = CType(httpWebRequest.GetResponse(), HttpWebResponse)
  23. Dim text As String = New StreamReader(httpWebResponse.GetResponseStream()).ReadToEnd()
  24. obj = (text.Contains("ok") And Not text.Contains("username"))
  25. Catch expr_119 As Exception
  26. ProjectData.SetProjectError(expr_119)
  27. Dim projectError As Exception = expr_119
  28. ProjectData.SetProjectError(projectError)
  29. obj = False
  30. ProjectData.ClearProjectError()
  31. result = obj
  32. ProjectData.ClearProjectError()
  33. Return result
  34. End Try
  35. result = obj
  36. Return result
  37. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement