Sign in to follow this  
Followers 0
Buffo

Possible to use PHP POST & GET methods

8 posts in this topic

Hi!

Here is a vbs script that I want to integrate complete in AutoIt because first of all I don't want to use FileInstall and secondly not on all computers the windows scripting host ist enabled or installed.

This is the script (simplified):

Set objHTTP = CreateObject("MSXML2.XMLHTTP")
Call objHTTP.Open("POST", "http://192.168.0.1/start.login", False)
objHTTP.Send("P1=pass")

Call objHTTP.Open("GET", "http://192.168.0.1/pppctl.cmd?action=1", False)
objHTTP.Send

I don't use vbs and have no idea to convert. For POST and GET methods I searched the help (nothing found) and the forum (thousands of hits but not with a solution for me.

I would be very lucky if you can help me :whistle:

Thx in advance.

Regards,

Buffo

Share this post


Link to post
Share on other sites



Just curious if you've tried the IE.au3 udfs?


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

This source may help

$oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Install a custom error handler 
$ResolveTimeout = 5000
$ConnectTimeout = 5000
$SendTimeout = 5000
$ReceiveTimeout = 5000
$sUrl = "http://192.168.0.1/start.login"
$PostData = "P1=pass"
$oHttpRequest = ObjCreate("MSXML2.ServerXMLHTTP")
$oHttpRequest.Open ("POST", $sUrl,True)
$oHttpRequest.setRequestHeader  ("Content-Type", "application/x-www-form-urlencoded") ; Need to change as per your webpage
$oHttpRequest.setRequestHeader  ("Connection", "Keep-Alive")
$oHttpRequest.Send ($PostData)
sleep(1000)
$oHttpRequest = ""

Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

Share this post


Link to post
Share on other sites

Just curious if you've tried the IE.au3 udfs?

I searched in the IE.au3 for "post" and I only get some lines in an example function. If it is possible withe the IE.au3 I would be glad if you can tell me how, I don't know how to :whistle:

@Hasher: Thx a lot I will try both suggestions :D

But one question: The line

$oHttpRequest.setRequestHeader  ("Content-Type", "application/x-www-form-urlencoded"); Need to change as per your webpage

How to find the content-type? It is my router so I didn't make the "webpage" myself :P

Share this post


Link to post
Share on other sites

Use Fiddler to get all the information ((including content-type) you need to make the function work : http://www.fiddlertool.com/fiddler/ .


Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

Share this post


Link to post
Share on other sites

Fiddler will not work for me.

There is a error when I want to access the router page: "Expected is CRLFCRLF returned is LFLF."

Another idea?

Share this post


Link to post
Share on other sites

Do you have a webpage with a Form with post function in it already? If so please paste the code..... You can PM if you dont want it posted in public


Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

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