Jump to content

_HTTPPost


Recommended Posts

Hey all,

I'm still fairly new to AutoIt, still absolutely lovin it. Still amazed at how powerful this somewhat 'unheard' language is....but anyway, on to my issue.

I'm trying to do what I feel should be a simple task; Post to a php script. Here's what I got.

Local $webHost = "www.mywebsite.com"
Local $webFile = "/folder/folder/file.php"
Local $webSocket 
Local $postData = _HTTPEncodeString($stringToSend)

If $webSocket = _HTTPConnect("www.mywebsite.com") == 1 Then
    MsgBox(0, "test", "Fail, no Socket")
EndIf
;socket does return what looks like a good value, don't know what it means, but it's 3000 something...

;this was only to see what was returned, which i'm sure you'd know
Local $test
$test = _HTTPPost($webHost, $webFile, $webSocket, "param=" & $postData)
MsgBox(0, "test", $test)
;this is returning 0, which i guess was supposed to be bytes sent

If _HTTPPost($webHost, $webFile, $webSocket, "?param=" & $postData) == 1 Then
    MsgBox(0, "Fail 1", "Still fail, no socket")
ElseIf _HTTPPost($webHost, $webFile, $webSocket, "?param=" & $postData) == 2 Then
    MsgBox(0, "Even Still Fail", "Error sending to Socket")
Else
    MsgBox(0, "Success", "I think")
EndIf

;the success MsgBox is the one that shows

Don't really know what I'm doing wrong, it makes it difficult since the udf is not complying with autocomplete. So, I'm not even sure what's right.

Any advice?

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...