1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Twitter Account CReator

Discussion in 'Visual Basic .NET' started by KirtiD, Nov 28, 2013.

  1. KirtiD

    KirtiD Newbie

    Joined:
    Jun 13, 2013
    Messages:
    49
    Likes Received:
    15
    Location:
    Beed
    hello I am trying to create HTTP web request base twitter account creator, its not working, I followed same steps which I recorded while doing it manually

    Code:
     Private Function DoRegistUser()        Dim cookieJar = New CookieContainer()
            Dim UrlRegister1 As String = "https://twitter.com/signup"
            Dim UrlRegister As String = "https://twitter.com/account/create"
    
    
            Dim postPara As String
    
    
            Dim txtSignupPage As String = TwEasy.Helpers.HelpRequest.SendRequest(cookieJar, UrlRegister1, False, "", "")
            Dim document = New HtmlDocument()
            document.LoadHtml(txtSignupPage)
    
    
            Dim node As HtmlNode = document.DocumentNode.SelectSingleNode("//input[@name='authenticity_token']")
            Dim authenticity_token As String = node.Attributes("Value").Value
            Dim paramatersCreate = New Dictionary(Of String, String)()
    
    
            postPara = ("authenticity_token=" + authenticity_token + "&user%5Bname%5D=kirtast+amauajaop&user%5Bemail%5D=laioamaklklam90%40yahoo.com&user%5Buser_password%5D=abcd123456&user%5Bscreen_name%5D=mkaioaakjau90&user%5Bremember_me_on_signup%5D=1&user%5Buse_cookie_personalization%5D=1&asked_cookie_personalization_setting=1&context=&ad_id=&ad_ref=&user%5Bdiscoverable_by_email%5D=1&user%5Bsend_email_newsletter%5D=1")
    
    
            txt = SendRequest(cookieJar, UrlRegister, True, postPara)
            Return ""
    
    
    
    
        End Function
     
  2. gimme4free

    gimme4free Executive VIP Jr. VIP Premium Member

    Joined:
    Oct 22, 2008
    Messages:
    1,881
    Likes Received:
    1,932
    It would help to know what the TwEasy class is. Are you managing cookies between requests (Are they actually being added to the cookiejar?)

    Where exactly is it going wrong? Not much info above.
     
  3. KirtiD

    KirtiD Newbie

    Joined:
    Jun 13, 2013
    Messages:
    49
    Likes Received:
    15
    Location:
    Beed
    hi

    here is complete code , i can see cookieJar contain cookies, when my program post signup request twitter redirect me to https://twitter.com/account/new but it shows signup page so no error or success as well

    Code:
     
    
    
     Dim strProxyServer As String
        Dim proxyObject As WebProxy
        Dim cookieJar As CookieContainer = New CookieContainer
        Dim txt As String = ""
        Dim SubmitPARA As String = ""
        Dim strServiceTag As String
        Dim ccookieJar As String = ""
        Dim cookiestr As String = ""
        Dim key1 As String = ""
        Dim key2 As String = ""
    
    
        Dim email As String = "mkamkma90@yahoo.com"
        Dim password As String = "Huakip90"
        Dim fName As String = "Hellen"
        Dim LName As String = "Stavews"
        Dim username As String = "hellenstw889"
        Dim strServiceName As String = "https://twitter.com/"
        Dim full As String = fName & LName
        Dim strKey1 As String = ""
        Dim token As String
    Function SendRequest(ByRef cookieJar As CookieContainer, ByVal strURL As String, ByVal boolPost As Boolean, Optional ByVal strParameter As String = "", Optional ByVal strReferer As String = "") As String
            Dim strHTML As String
            Dim webReq As HttpWebRequest
            Dim webResp As HttpWebResponse
            Dim sw As StreamWriter
            Dim sr As StreamReader
    
    
            webReq = CType(WebRequest.Create(New Uri(strURL)), HttpWebRequest)
            webReq.CookieContainer = cookieJar
            webReq.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
            webReq.Credentials = CredentialCache.DefaultCredentials
            webReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.12) Gecko/20100824 Firefox/3.5.12"
            webReq.ContentType = "application/x-www-form-urlencoded"
            webReq.AllowAutoRedirect = True
            webReq.MaximumAutomaticRedirections = 3
            webReq.KeepAlive = True
            If strReferer <> "" Then
                webReq.Referer = strReferer
            End If
            If boolPost = True Then
                webReq.Method = "POST"
                webReq.ContentLength = strParameter.Length
                sw = New StreamWriter(webReq.GetRequestStream)
                sw.Write(strParameter)
                sw.Close()
            Else
                webReq.Method = "GET"
            End If
            webResp = webReq.GetResponse
            If webResp.StatusCode = HttpStatusCode.BadGateway Or webResp.StatusCode = HttpStatusCode.BadRequest Or webResp.StatusCode = HttpStatusCode.Forbidden _
             Or webResp.StatusCode = HttpStatusCode.GatewayTimeout Or webResp.StatusCode = HttpStatusCode.Gone Or webResp.StatusCode = HttpStatusCode.NotFound _
             Or webResp.StatusCode = HttpStatusCode.RequestTimeout Then
                strHTML = "SiteDown"
                Return strHTML
            End If
    
    
            sr = New StreamReader(webResp.GetResponseStream)
            strHTML = sr.ReadToEnd.Trim
            Return strHTML
        End Function
       
    
    
     Private Function DoRegistUser()
            Dim cookieJar = New CookieContainer()
            Dim UrlRegister1 As String = "https://twitter.com/signup?context=webintent"
            Dim UrlRegister As String = "https://twitter.com/account/create"
    
    
            Dim postPara As String
    
    
            Dim txtSignupPage As String = SendRequest(cookieJar, UrlRegister1, False, "", "")
            Dim document = New HtmlDocument()
            document.LoadHtml(txtSignupPage)
    
    
            Dim node As HtmlNode = document.DocumentNode.SelectSingleNode("//input[@name='authenticity_token']")
            Dim authenticity_token As String = node.Attributes("Value").Value
            Dim paramatersCreate = New Dictionary(Of String, String)()
    
    
            postPara = ("authenticity_token=" + authenticity_token + "&user%5Bname%5D=kirtast+amauajaop&user%5Bemail%5D=laioamaklklam90%40yahoo.com&user%5Buser_password%5D=abcd123456&user%5Bscreen_name%5D=mkaioaakjau90&user%5Bremember_me_on_signup%5D=1&user%5Buse_cookie_personalization%5D=1&asked_cookie_personalization_setting=1&context=&ad_id=&ad_ref=&user%5Bdiscoverable_by_email%5D=1&user%5Bsend_email_newsletter%5D=1")
    
    
            txt = SendRequest(cookieJar, UrlRegister, True, postPara)
            Return ""
    
    
    
    
        End Function
    
    
    
    In this code I used HTML agility pack to extract authenticnticity_token