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

How can I make an account creator and poster?

Discussion in 'Visual Basic .NET' started by kytro360, May 23, 2011.

  1. kytro360

    kytro360 Power Member

    Joined:
    Jan 12, 2010
    Messages:
    703
    Likes Received:
    732
    Ive been learning Visual Basic 2010 and I wanna make a cool program which I can share here on BHW.

    Basically I want it to create accounts on the sites and post on them.

    Do I have to learn httpwebrequest or...?

    Any input is appreciated. Thank you
     
  2. w84it

    w84it Regular Member

    Joined:
    Jun 18, 2009
    Messages:
    442
    Likes Received:
    752
    Yes..
     
  3. kytro360

    kytro360 Power Member

    Joined:
    Jan 12, 2010
    Messages:
    703
    Likes Received:
    732
    Do you know of any good tutorials?
     
  4. jangedoo

    jangedoo Registered Member

    Joined:
    Jan 12, 2010
    Messages:
    59
    Likes Received:
    41
    httpwebrequest is easy...
    here is how you do it:

    Code:
    Dim requset as httpwebrequest = httpwebrequest.create(txtUrl.text)
    Dim response As HttpWebResponse = CType(request.GetResponse, HttpWebResponse)
    
    Dim reader As New StreamReader(response.GetResponseStream)
    Dim html As String = reader.ReadToEnd
    
    the html variable now contains the source of the page. Do anything you like with it :D
     
    • Thanks Thanks x 1
  5. kytro360

    kytro360 Power Member

    Joined:
    Jan 12, 2010
    Messages:
    703
    Likes Received:
    732
    But what do you mean by the do whatever you want with it? Is there any other special webrequest code involved or can I now just do regular VB coding and get the id if the forms and post to it?
     
  6. jangedoo

    jangedoo Registered Member

    Joined:
    Jan 12, 2010
    Messages:
    59
    Likes Received:
    41
    ya, get the form fields and build a POST string,
    like if there are two inputs named "user" and "password" then your POST string will be like

    For this example, we'll be logging in into a website's admin panel.
    Form handler for the login will be (somewebsite/login.php) and after login you'll be redirected to admin panel (somewebsite/admin.php)

    Code:
    Dim postData = "user=" & txtUser.Text & "&password=" & txtPassword.Text
    Dim encoding As New ASCIIEncoding()
    
    Dim byte1 As Byte() = encoding.GetBytes(postData)
    
     Dim cookie As New CookieContainer
    
    'Now pass the data to the form handler, in this case lets consider (somewebsite/login.php)
    
    Dim request As HttpWebRequest = HttpWebRequest.Create("somewebsite/login.php"l)
    request.Method = WebRequestMethods.Http.Post
    request.ContentType = "application/x-www-form-urlencoded"
    request.ContentLength = byte1.Length
    request.CookieContainer = cookie
    
    Dim postStream As Stream = request.GetRequestStream
    
    postStream.Write(byte1, 0, byte1.Length)
    postStream.Close()
    
    Dim response As Stream = request.GetResponse.GetResponseStream
    Dim reader As New StreamReader(response)
    
    Dim html As String = reader.ReadToEnd
    
    Now, html variable will have the source of admin.php page... Now do what ever you want to do with it. :D
    If you need help contact me.
    Happy coding!
     
    • Thanks Thanks x 1
  7. kytro360

    kytro360 Power Member

    Joined:
    Jan 12, 2010
    Messages:
    703
    Likes Received:
    732
    Thanks but I'm going to Pm since the concept is still confusing
     
  8. simpleonline1234

    simpleonline1234 Junior Member

    Joined:
    Jan 26, 2010
    Messages:
    169
    Likes Received:
    13
    There is also another way but not as good as httpwebrequest. You can use browsers instead. I started that way in the beginning when I first started created bots for sites.

    Was able to setup Tumblr, LiveJournal, etc accounts and post information.

    You grab the elements by their ID tag names....if you right click on any web page that has a username, password, etc you can view the source code.

    Scroll down to where you see the input field for the user to input their data...from this area the webmaster can use id's, names, classes, etc to link the input box to the site.

    What you do is create a textbox on your app, grab the id of the website for that textbox, username and set the value to whatever you put into your textbox.

    Example.

    If you right click on the webpage and you find the username field in the source code and the web master has named that textbox id=username then you can create a textbox on your app and then grab the textbox by it's id="username" and text the value of your app to the website.

    Here's an example of what the code would look like.

    Code:
    For Each element As HtmlElement In WebBrowser1.Document.GetElementsByTagName("input")
    If element.GetAttribute("id") = "idname" Then
    element.SetAttribute("value", TextBox1.Text)
    End If
    Next
    You can copy and paste that into your web browser completed field and just replace the idname with whatever the web master has used to create their field.

    There is of course more to it if they use classes, or names but this will get you started.

    Also I will say that the browser method is much slower than the httpwebrequest version but at least you can code something that works and you can play around with to get to more comfortable with the concepts of web proggramming.
     
    • Thanks Thanks x 2
  9. kytro360

    kytro360 Power Member

    Joined:
    Jan 12, 2010
    Messages:
    703
    Likes Received:
    732
    Thanks
     
  10. kytro360

    kytro360 Power Member

    Joined:
    Jan 12, 2010
    Messages:
    703
    Likes Received:
    732
    Ok guys I finally got the hang of web request. My question though is how do I click more than one thing automatically not semi-automatically?
     
  11. smack

    smack Junior Member

    Joined:
    Feb 1, 2010
    Messages:
    182
    Likes Received:
    78
    Occupation:
    Software Engineer/Evil Genius
    Location:
    inside .NET
    you're not "clicking" anything with httpwebrequest. you're working with the http request/responses going back and forth to the server.

    did you mean with the web browser control?
     
  12. kytro360

    kytro360 Power Member

    Joined:
    Jan 12, 2010
    Messages:
    703
    Likes Received:
    732
    Wait so your saying httpwebrequest doesnt click anything?

    So yea how would I incorporate httpwebrequest and webbrowser control?

    I know how to click a button, this is some example code:

    Code:
    Public Class Form1      Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load         WebBrowser1.Navigate("http://login.facebook.com/login.php")     End Sub      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click         Dim allelements As HtmlElementCollection = WebBrowser1.Document.All          For Each webpageelement As HtmlElement In allelements              If webpageelement.GetAttribute("value") = "News and Updates" Then                  webpageelement.InvokeMember("click")              End If          Next     End Sub  End Class
    But how would I make the bot combine both of those at the click of one button.

    Do I add loops or something? I dont know
     
  13. ekologic

    ekologic Registered Member

    Joined:
    Oct 25, 2010
    Messages:
    64
    Likes Received:
    2
    Occupation:
    Wanna be an autoblogger
    Location:
    in facebook
    I don not vb but the concept is the same.

    Find the button you want to click in the html code. Once you locate it find the parent tag "<form>" and you make the webrequest by puting your variables according to all the input fields in the "<form></form>" tag.

    PS. You should be somehow familiar with html and install FIREFOX and DOWNLOAD FIREBUG. Your life will be a lot more easier
     
  14. kytro360

    kytro360 Power Member

    Joined:
    Jan 12, 2010
    Messages:
    703
    Likes Received:
    732
    How would I put the variables in httpwebrequest?
     
  15. tshin810

    tshin810 Junior Member

    Joined:
    Jun 16, 2009
    Messages:
    163
    Likes Received:
    668
    If you're new to programming, I suggest you use webbrowser method because you can find many tutorials. It's harder to learn httpwebrequest and it's pretty hard to find good tutorials about it. If you insist to learn it, here's the tutorial that I learnt from it:

    Code:
    http://howtostartprogramming.com/vb-net/vb-net-tutorial-51-httpwebrequest-post-method/
     
  16. kytro360

    kytro360 Power Member

    Joined:
    Jan 12, 2010
    Messages:
    703
    Likes Received:
    732
    I have already seen the video but it only teaches you how to login in to a site but not actually click stuff and fill forms
     
  17. w84it

    w84it Regular Member

    Joined:
    Jun 18, 2009
    Messages:
    442
    Likes Received:
    752
    webrequests are made when you click "stuff" and "fll forms"
    You have to build the webrequests yourself.
     
  18. aladin

    aladin Junior Member

    Joined:
    Sep 18, 2008
    Messages:
    151
    Likes Received:
    8
    Occupation:
    Medicine SEO
    Location:
    Romania Iasi
    do you have experience in C#?
    I am trying to learn and to apply same things but in C#.
    I find C# more simpler at syntax but I find fewer tutorials and training resources about managing httpwebrequest.
    I started my own application in C# and and it is hard to return from my way to the VB net..

    The sample codes in VB.net can be converted in C#.net?

    Regards.
     
  19. ekologic

    ekologic Registered Member

    Joined:
    Oct 25, 2010
    Messages:
    64
    Likes Received:
    2
    Occupation:
    Wanna be an autoblogger
    Location:
    in facebook
    yes there were converters.
    come one in i guess in the principles are the same for HTTP class, the syntax which matters and rest is the same
     
  20. daymond

    daymond Junior Member Premium Member

    Joined:
    May 24, 2011
    Messages:
    185
    Likes Received:
    40
    I recommend C# or java with httpclient lib, make something easy like comment poster than add decaptcher/deathbycpatcha and improve your prog. Visual Basic is not so good, it's very old language
     
    • Thanks Thanks x 1