Jump to content

HttpWebRequest


Gravity
 Share

Recommended Posts

Ok. Soo i changed my mind.. I want to use web request for login in my application . For guys that dont know . I am making application in which you login to application .And you have functions for vip or free . I setuped forum in which you can register . And i want to do when user is logging then it get response from site if id and password is right . Soo this code is right ?

Global $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")

$oHTTP.Open("GET", "testserver.com/login.php", False)

$oHTTP.Send()

$response= $oHTTP.ResponseText

Edited by Gravity
Link to comment
Share on other sites

  • Moderators

You're asking if the code is right, which begs the question - have you tried it? If you're having a particular problem with the code, please give us a little more detail as to the error so we can help you troubleshoot.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

"it don't works" doesn't tell us anything. Are you getting an error? What error checking have you put in place, so you can figure out just where the script fails? At minium you should have something like this:

Global $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")

   If IsObj($oHTTP) Then
       $oHTTP.Open("GET", "testserver.com/login.php", False)
            If @error Then
                MsgBox(0, "", "Error on Open")
            Else
                $oHTTP.Send()
                    If Not @error Then $response= $oHTTP.ResponseText
            EndIf
    EndIf

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

You're not learning it, you're asking someone to barf up code for you. This should be a couple of steps for you:

  1. Copy the code I have in post #5.
  2. Change the URL to your URL (or post the URL here)
  3. Run the code to see where it errors.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...