4 Replies - 522 Views - Last Post: 17 August 2012 - 04:31 PM Rate Topic: -----

#1 lukas76  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 91
  • Joined: 20-January 08

[Webrequests] Any good tutorial?

Posted 12 August 2012 - 04:39 PM

I've been playing around with the tutorial on this site: http://howtostartpro...st-post-method/

But it's very outdated and the site used to teach you webrequests has been updated/changed.

Any good tutorials and a site to test this new-found knowledge with?

Any help would be greatly appreciated!

Is This A Good Question/Topic? 0
  • +

Replies To: [Webrequests] Any good tutorial?

#2 _HAWK_  Icon User is online

  • Master(Of Foo)
  • member icon

Reputation: 1057
  • View blog
  • Posts: 4,100
  • Joined: 02-July 08

Re: [Webrequests] Any good tutorial?

Posted 12 August 2012 - 10:40 PM

I an no expert in this area, but it looks to be quite applicable. Do you have any specific issues?
Was This Post Helpful? 0
  • +
  • -

#3 lukas76  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 91
  • Joined: 20-January 08

Re: [Webrequests] Any good tutorial?

Posted 13 August 2012 - 03:28 AM

View Post_HAWK_, on 12 August 2012 - 11:40 PM, said:

I an no expert in this area, but it looks to be quite applicable. Do you have any specific issues?


Any more most if not all websites with a basic form login page have you include a phpsessionid in when you go to "post" data.

To get the phpsessionid would i have to do a GET request and save the cookies i get in the same cookie i want to use for the POST request?
Was This Post Helpful? 0
  • +
  • -

#4 deery5000  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 976
  • Joined: 09-May 09

Re: [Webrequests] Any good tutorial?

Posted 17 August 2012 - 03:05 PM

**** BOOM ****

Try this

Dim request As HttpWebRequest
        Dim response As HttpWebResponse = Nothing
        Dim reader As StreamReader
        Dim result As String

        Try
            ' Create the web request   
            request = DirectCast(WebRequest.Create(connectionString), HttpWebRequest)

            'Get response   
            response = DirectCast(request.GetResponse(), HttpWebResponse)

            ' Get the response stream into a reader   
            reader = New StreamReader(response.GetResponseStream())

            ' Read the whole contents and return as a string   
            result = reader.ReadToEnd()
            reader.Close()

        Catch e As Exception

            If Not response Is Nothing Then response.Close()

            Return 0
        End Try

        response.Close()
        reader.Close()
        response = Nothing
        request = Nothing

        Return result



pass in a connection string

kevin
Was This Post Helpful? 0
  • +
  • -

#5 lukas76  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 91
  • Joined: 20-January 08

Re: [Webrequests] Any good tutorial?

Posted 17 August 2012 - 04:31 PM

View Postdeery5000, on 17 August 2012 - 04:05 PM, said:

**** BOOM ****

Try this

Dim request As HttpWebRequest
        Dim response As HttpWebResponse = Nothing
        Dim reader As StreamReader
        Dim result As String

        Try
            ' Create the web request   
            request = DirectCast(WebRequest.Create(connectionString), HttpWebRequest)

            'Get response   
            response = DirectCast(request.GetResponse(), HttpWebResponse)

            ' Get the response stream into a reader   
            reader = New StreamReader(response.GetResponseStream())

            ' Read the whole contents and return as a string   
            result = reader.ReadToEnd()
            reader.Close()

        Catch e As Exception

            If Not response Is Nothing Then response.Close()

            Return 0
        End Try

        response.Close()
        reader.Close()
        response = Nothing
        request = Nothing

        Return result



pass in a connection string

kevin


thanks but no thanks man, I'm having trouble with the phpsessionID. Plus it doesn't really show its self as a tutorial. Sorry for being blunt but thanks again. :)

I'd rather be handed the fishing pole and not the fish. Works 100% better in the long run.

This post has been edited by lukas76: 17 August 2012 - 04:32 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1