Jump to content
Sign in to follow this  

How to send large strings over http?

Recommended Posts

I want to send with either post or get serveral &vars= to a php page. This works with my first example as long as the total url string is less then something like 2000 chars.

msgbox(0,"",stringlen($sUrl)&". "&$sData)

So then I thought lets try something else like post with WinHttp.au3, but whatever I try this next example never sends anything.

$hInternet = _WinHttpOpen()
$hConnect = _WinHttpConnect($hInternet, "")
$sPost = "test1=bla&test2=bla"
$sResult = _WinHttpSimpleRequest($hConnect, "POST", "/final/com/insert.php", '', $sPost)
MsgBox(0, '',stringlen($str)&". "&$sResult)

So can anyone perhaps tell me how I could use autoit to make this work? Or is there some max on the post/get string?

Edited by Rutger83

Share this post

Link to post
Share on other sites

This works:)

; Creating the object
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST", "", False)
$oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")

; Performing the Request

; Download the body response if any, and get the server status response code.
$oReceived = $oHTTP.ResponseText
$oStatusCode = $oHTTP.Status

Share this post

Link to post
Share on other sites

You may also need to send large data in chunks, and sleep briefly to give the receiver time to catch up. TCP flow control is supposed to do this, but I found threads suggesting that this is necessary, and I did it for my own projects. Also worth considering, I just read a thread that uses PNG as a compression tool, very interesting, and it might have the size of the data you need to send.

Happy coding.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...