Buffo Posted March 15, 2007 Posted March 15, 2007 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 Thx in advance. Regards, Buffo
Moderators SmOke_N Posted March 15, 2007 Moderators Posted March 15, 2007 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.
Hasher Posted March 15, 2007 Posted March 15, 2007 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!
Hasher Posted March 15, 2007 Posted March 15, 2007 You can also use Http.au3 found here:http://www.autoitscript.com/forum/index.ph...amp;hl=Http.au3Has functions _httppost and _httpget Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of shhh extensions!
Buffo Posted March 15, 2007 Author Posted March 15, 2007 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 @Hasher: Thx a lot I will try both suggestions 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
Hasher Posted March 15, 2007 Posted March 15, 2007 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!
Buffo Posted March 16, 2007 Author Posted March 16, 2007 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?
Hasher Posted March 16, 2007 Posted March 16, 2007 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!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now