Solved read http response

Posted on 2012-08-21
Last Modified: 2012-08-21

I am using the the procedure below to read the response from a post that
I made to a URL.
THe following three lines only return a few characters. I am not sure that I am getting
everything from the response.
Is there a way to get more?from a site that returns hotel booking information. Thanks

The reason I ask is because this is
       Dim Answer As Stream = WebResp.GetResponseStream()
        Dim _Answer As New StreamReader(Answer)

    Private Shared Sub start_get()
        'Our getVars, to test the get of our php.
        'We can get a page without any of these vars too though.
        Dim getVars As String = "?var1=test1&var2=test2"
        'Initialization, we use localhost, change if applicable

        Dim WebReq As HttpWebRequest = DirectCast(WebRequest.Create(String.Format("", getVars)), HttpWebRequest)
        'This time, our method is GET.
        WebReq.Method = "GET"
        'From here on, it's all the same as above.
        Dim WebResp As HttpWebResponse = DirectCast(WebReq.GetResponse(), HttpWebResponse)
        'Let's show some information about the response

        'Now, we read the response (the string), and output it.
        Dim Answer As Stream = WebResp.GetResponseStream()
        Dim _Answer As New StreamReader(Answer)

        'Congratulations, with these two functions in basic form, you just learned
        'the two basic forms of web surfing
        'This proves how easy it can be.
    End Sub
Question by:murbro
    LVL 83

    Expert Comment


    You are doing a readtoend which means you read the whole stream that was returned by the server.

    Author Comment

    Thanks. What code would I use to read each line?
    LVL 83

    Accepted Solution

    Split the string on VBCRLF.

    For each Line As String in _Answer.ReadToEnd().Split(VBCRLF)
       msgbox Line

    Author Closing Comment

    Great. Thank you

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now