Jump to content
Sign in to follow this  
Darkbanner

Need help with WinHttp

Recommended Posts

Hi have a page with this content:

<html>
<body>
<form action="upload_file.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>

I want auto it to fill in the filepath with the var $file and then submit the form.

How to do?

Regards Darkbanner

Share this post


Link to post
Share on other sites

There's functional example code in the Help file that may help you understand how it works. Asking for someone to write the code for you will almost certainly get you nothing but negative replies.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

#include <IE.au3>
Local $oIE = _IECreate("http://razorhosting.de/imgspy/")
Local $oForm = _IEFormGetObjByName($oIE, "form")
Local $oText = _IEFormElementGetObjByName($oForm, "file")
Local $oSub = _IEFormGetObjByName($oIE, "submit")
_IEFormElementSetValue($oText, "Hey! This works!")
Sleep(100)
_IEFormSubmit($oForm)

This inserts the "hey! this works!" text but the submit don't work

Share this post


Link to post
Share on other sites

This is very easy, I recommend that you sit down and read the winhttp.au3 instruction manual, more specifically, read about "_WinHttpSimpleFormFill".

#include "WinHttp.au3"
Global $hOpen, $hConnect, $sRead

$hOpen = _WinHttpOpen()
$hConnect = _WinHttpConnect($hOpen, "domain.com")
$sRead = _WinHttpSimpleFormFill($hConnect, "test.php", "index:0", "name:file", $FileLocation)
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)

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