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

VB.NET When filling forms for registrations which to use Webrequest or Webbrowser?

Discussion in 'Visual Basic .NET' started by simpleonline1234, Aug 30, 2011.

  1. simpleonline1234

    simpleonline1234 Junior Member

    Joined:
    Jan 26, 2010
    Messages:
    170
    Likes Received:
    13
    I am attempting to create an application in VB.NET where I would go to a few hundred websites and create accounts for each site.

    Would Webbrowser be the best solution or httpwebrequest?

    I know that httpwebrequest is fast because it doesn't use a browser to run the code but damn filling forms is so hard to figure out.

    Webbrowser seems easier but damn if it isn't slow as hell.

    Which method do you think is more efficient at getting the job done the right way with the best speed?
     
  2. scriptomania

    scriptomania Junior Member

    Joined:
    Dec 28, 2010
    Messages:
    127
    Likes Received:
    249
    Occupation:
    A full time pirate at sea
    Location:
    The European capital of politics
    Sockets or direct HTTP requests, no doubt. Don't use the webbrowser unless absolutely necessarily (for example with sites that check from browser use unless you feel like fucking about with validation strings...)

    The browser is slow as hell, consumes tons of memory and is not really suitable for multiple threads (youd have issues isolating browsing sessions for example).

    Nothing really hard about HTTP requests either...

    Cheers
     
  3. simpleonline1234

    simpleonline1234 Junior Member

    Joined:
    Jan 26, 2010
    Messages:
    170
    Likes Received:
    13
    Okay here is what I got...let me know if this seems right.

    I create an Httpwebrequest to the server.
    The server returns the response.
    I create an Httwebresponse and put the returned results into the httpwebresponse.

    Now I have to get that information into something I can do something with.

    I create a StreamReader

    I need someway to handle the actual data so I put the result into a string
    Then I tell the string to read to end.

    Finally I have the data in the form of a string.

    I can output that string into a richtextbox, textbox, etc

    Does this sound about right when it comes to Httpwebrequest/response?
     
  4. scriptomania

    scriptomania Junior Member

    Joined:
    Dec 28, 2010
    Messages:
    127
    Likes Received:
    249
    Occupation:
    A full time pirate at sea
    Location:
    The European capital of politics
    Yep, you got the basics down. Essentially what you would receive from the server is just another web document, provided that your request was successful (e.g. you got a 200 OK response from the server). Then you just need to parse it and do whatever with it.

    Hope this makes sense?
     
    • Thanks Thanks x 1
  5. simpleonline1234

    simpleonline1234 Junior Member

    Joined:
    Jan 26, 2010
    Messages:
    170
    Likes Received:
    13
    Ha...thanks for the reply...yeah it's starting to sink in...it takes a little while for me sometimes.
     
  6. wowhaxor

    wowhaxor Elite Member

    Joined:
    Apr 28, 2007
    Messages:
    2,020
    Likes Received:
    3,361
    Location:
    ?¿?
    Home Page:
    webbrowser is definitely slower but is necessary on some sites. Avoid it if possible though!
     
  7. Hydrogen

    Hydrogen Newbie

    Joined:
    Dec 30, 2009
    Messages:
    39
    Likes Received:
    23
    Occupation:
    Co-Owner of AdvertMarketing
    Home Page:
    The only time a Browser Control is needed is if the site uses extensive javascript validation to ensure there is no bots running their page. The only site I've seen this really used successfully was on a browser-based game called Bootleggers.us

    Other then that, use httpwebrequest as often and as much as possible being that it is able to be multi-threaded where as Browser Controls really can not (without significant overhead (which you don't want).

    When using httpwebrequest though be sure to ALWAYS, ALWAYS regardless of what tutorial you read or whatever, include User-Agents (can rotate out or be selectable by the user if you want, not always needed unless you want the bot to appear to use multiple browser types), Referrers (this is overlooked by alot of bot developers and it's a shame) without using referrers it definitely throws up red flags to whoever is looking at logs (provided you are botting/Automating a particular site 'ie, twitter')

    When creating a bot for a website always RESEARCH your little coding heart out, on your target, using apps such as Fiddler, LiveHttpHeaders whatever) to understand how the site is interacting with the browser so you can go back and replicate it in your bot.

    When I write bots, 90% of the development time is Research where only 10% is actual coding.

    "Knowledge only makes your Stronger!"
     
    • Thanks Thanks x 1