Question HTTP Posting

Haxaro

Well-known member
Joined
Mar 13, 2009
Messages
105
Programming Experience
1-3
I am making an app that will check the user credentials for a PHP page. But, i need 3 variables... the username, password, and a string that will tell the PHP page what the application wants doing. In this case, it should be "validate" but in other occasions it may be screenshot etc.

How can i send three strings to the PHP page, and receive the responce.

Here is my current code, but it returns a funny output, always the same, even if the login is correct or not:

VB.NET:
    Public Function Post(ByVal Password As String)
        Dim request As HttpWebRequest
        Dim response As HttpWebResponse = Nothing
        Dim reader As StreamReader

        Try
            request = DirectCast(WebRequest.Create("MYPHPPAGE"), HttpWebRequest)
            request.Credentials = New NetworkCredential(TextBox1.Text, Password, "validate")

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

            reader = New StreamReader(response.GetResponseStream())

            RichTextBox1.Text = (reader.ReadToEnd())
        Finally
            If Not response Is Nothing Then response.Close()
        End Try

    End Function

Please help :)
 
Back
Top