Results 1 to 5 of 5

Thread: HTTP GET Request Difficulty

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Manchester
    Posts
    266

    HTTP GET Request Difficulty

    Okay, i've tried httpwebrequest, webclient, and a couple of others methods; using the headers parameter of each to set headers and then either opening a response stream or simply setting the system.net.webclient method to download a response into a string. No luck!

    Put simply, how do I make a simple GET request with a few headers and read the data back! I am very, very stuck in a hole right now..

  2. #2
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    Re: HTTP GET Request Difficulty

    I've got a very simple example here, perhaps it will help you. Click on the 'How to make a web request' link down in my signature.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Manchester
    Posts
    266

    Re: HTTP GET Request Difficulty

    Thanks for your help cicatrix, is this class able to support the sending of header data?

  4. #4
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    Re: HTTP GET Request Difficulty

    You shoud modify it a bit, but yes. Use Webrequest.Headers collection to modify the default header strings.
    Usually, you don't even need to do that (if you simply want to get a html page, but if you wish, - use wrq.Headers collection)

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Location
    Manchester
    Posts
    266

    Re: HTTP GET Request Difficulty

    Quote Originally Posted by cicatrix View Post
    You shoud modify it a bit, but yes. Use Webrequest.Headers collection to modify the default header strings.
    Usually, you don't even need to do that (if you simply want to get a html page, but if you wish, - use wrq.Headers collection)
    Great, thanks. In this case, I am using a REST API and so need to carefully structure my GET headers with API keys / handshake details etc. Thanks for your help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width