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

HttpWebRequest

Discussion in 'Visual Basic .NET' started by davemcm, Feb 9, 2009.

  1. davemcm

    davemcm Newbie

    Joined:
    Aug 6, 2008
    Messages:
    18
    Likes Received:
    0
    Just recently began coding again and wanted to make myself a torrent uploader, and maybe sell a few copies if theres any demand.

    I've been using the WebBrowser class and managed to get this working eventually after some ghetto hacks about 90% of the time..

    Now what im trying to do, is submit the form without using webbrowser and using httpwebrequest instead (quicker, n not so messy without sendkeys n such)

    Only problem is, i've no clue what i'm doing, i've read up on httpwebrequest and got a few examples, even managed to get it to simply submit a 1 field form with a file upload successfully, but every time i try on the torrent site it just throws a 417 Expectation Failed? (i think) which after doing a bit of reading, could be alot of things.

    I know i need to set the cookies and stuff for the captcha but, ill cross that bridge when i come to it, if i could even get the response page, with "The captcha you entered was incorrect", i'm sure i could sort it out from there.

    Soooo looking for a bit of help from the BH Vb.net coders... I think i even have $35 in webmoney which i would be more than happy to send if someone could write a httpwebrequest for a given site for me.

    Daaaaaaamn, long post, hope someone reads it!
     
  2. davemcm

    davemcm Newbie

    Joined:
    Aug 6, 2008
    Messages:
    18
    Likes Received:
    0
    okay after a bit of playing around now, i seem to have gotten this to work, well atleast submit the form....

    I now need to grab the cookies along with the captcha challenge field before i do the POST....

    any ideas?

    My simple GET httpwebrequest gets the page fine and i could parse the captcha challenge field out of it, but im pretty sure i need to set the cookies on the site anyway
     
  3. davemcm

    davemcm Newbie

    Joined:
    Aug 6, 2008
    Messages:
    18
    Likes Received:
    0
    ALL SORTED nevermind :)
     
  4. Tcm9669

    Tcm9669 Regular Member

    Joined:
    Dec 30, 2007
    Messages:
    369
    Likes Received:
    26
    You are doing that with the send keys? that is real pain! I doubt you'll manage to sell that... and why use the web browser? When you can use tons of other features...?
     
  5. seorebel

    seorebel Junior Member

    Joined:
    Aug 15, 2008
    Messages:
    174
    Likes Received:
    920
    SendKeys is the only way to alter an upload field when you use the webbrowser.. And yeah..a real pain in the butt... Also, the upload field is disabled in IE8, so you can't type anything in it.. httpwebrequest or webclient is the way to go.