Jump to content
Sign in to follow this  

WinHttp.au3 with POST and PHP

Recommended Posts


Ok my friends, I`m trying to send some data via POST using winhttp.au3 but it`s not working so far. I`m probably missing some detail about how using _WinHttpSendRequest or something. Please help!



$INPUT_NAME = "joe"


$adress = "www.test.com"

$openS = _WinHttpOpen()

$connector = _WinHttpConnect($openS, $adress)

$openRequest = _WinHttpOpenRequest($connector, "POST", "/check.php","HTTP/1.1")

$oPost = "username= $INPUT_NAME";

;send it

;_WinHttpSendRequest($openRequest,"Content-Type: application/x-www-form-urlencoded" & @CRLF, "username=" & $INPUT_NAME & "&password=" & $INPUT_PASSWORD)

;receive response with INET

$value = _INetGetSource ( "http://www.test.com/check.php" )

MsgBox(0, "The value is:", $value)


And this is my PHP code:


//Getting from app

$user_login = $_POST['username'];

$user_pass = $_POST['password'];

echo $user_login;


So just for test I`m trying to echo the user_login to check if the autoit is passing the variable to php but It`s not!

Share this post

Link to post
Share on other sites

#include <WinHttp.au3>
$INPUT_NAME = "joe"
$adress = "test.com"
$openS = _WinHttpOpen()
$connector = _WinHttpConnect($openS, $adress)
$openRequest = _WinHttpSimpleSendRequest($connector, "POST", "check.php",Default, "username="&$INPUT_NAME&"&"&"password="&$INPUT_PASSWORD)
If $openRequest Then
  Global $sendback = _WinHttpSimpleReadData($openRequest)
  Msgbox(0,"username: ",$sendback)

Edited by BiBiBi

Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.