Sign in to follow this  
Followers 0
Vindicator209

PHP Post

5 posts in this topic

Hi, I was wondering how I could pass variables to a php script.

At the moment, I'm automating a form submission by using the _IE functions, but I feel it would be much more efficient if I could directly send data to the php script that the form calls.

I tried _IENavigate(IE,"POST.php?name=NAME&class=CLASS") but it did not seem to work.

The form code is:

<form name='form' id='form' method='POST' action='POST.php'>
<input type='text' name='name' size='20' value="" />
<input type='text' name='class' size='30' value="" />
<input type='submit' name='submit' value='submit'/>

Thanks alot.


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites



Perhaps will help you.

_WinHttpSimpleFormFill function

Share this post


Link to post
Share on other sites

If you want to use IE.au3, there should be an undocumented _IENavigate2 or similar wich supports POST. Just open the include and search for it :)

As an alternative, you could open the form in the IE and then fill the form and submit it with _IEForm...

If you don't need IE or you want to be more independent, then the mentioned WinHTTP-library is a good choice. You can either send the POST directly or use FormFill to fill and send a form on a webpage.


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

This is the function I am using

Func _SendPing()
    Local $servername = "MyServer"
    Local $serverport = 80
    Local $ipconnection = -1
    Local $i, $r, $s, $t

    $t = ""
    For $i = 0 To (UBound($SysInfo, 1) - 1)
        $t &= "&" & $SysInfo[$i][0] & "=" & _UnicodeURLEncode($SysInfo[$i][1])
    Next
    $s = "POST /feedback/callhome.php HTTP/1.1" & @CRLF
    $s &= "Host: " & $servername & ":" & $serverport & @CRLF
    $s &= "From: " & @UserName & "@" & @ComputerName & @CRLF
    $s &= "User-Agent: DataPull/2.0" & @CRLF
    $s &= "Content-Type: application/x-www-form-urlencoded" & @CRLF
    $s &= "Content-Length: " & StringLen($t) & @CRLF & @CRLF
    $s &= $t
    TCPStartup()
    $ipconnection = TCPConnect(TCPNameToIP($servername), $serverport)
    $r = TCPSend($ipconnection, $s)
    Sleep(100)
    TCPShutdown()
EndFunc   ;==>_SendPing

$SysInfo is a 2 dimensional array of [variable name, value]

_UnicodeURLEncode() is from Dhilip89's UDF

These might also be helpful:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html

http://en.kioskea.net/contents/internet/http.php3

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  
Followers 0