nimexx Posted March 12, 2007 Posted March 12, 2007 Ok, this should be an easy one but I havent found a simple solution yet. All I want to do is post a timestamp to a url silently, like http://www.mydomain.com/test.asp?timestamp=whenever. I dont even need a response back from the webserver. I would hate to have to create an instance of IE when I dont need any kind of response and the user wont be seeing anything. I see the Inetget function but Im not trying to get a file so Im thinking posting data that way wouldnt work. The webpage is actually updateing an SQL database but Im not sure I want a few thousand PCs each opening a connection directly to the database.Anyone have a simple solution?
Hasher Posted March 12, 2007 Posted March 12, 2007 (edited) A function I like to use that is super fast, you can also use a proxy with this code..just google proxycfg.exe for its options Hope this helps $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Install a custom error handler $ResolveTimeout = 5000 $ConnectTimeout = 5000 $SendTimeout = 5000 $ReceiveTimeout = 5000 $sUrl = "http://www.mydomain.com/test.asp" $PostData = "timestamp=whenever" $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 = "" Edited March 12, 2007 by Hasher Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of shhh extensions!
seandisanti Posted March 12, 2007 Posted March 12, 2007 Ok, this should be an easy one but I havent found a simple solution yet. All I want to do is post a timestamp to a url silently, like http://www.mydomain.com/test.asp?timestamp=whenever. I dont even need a response back from the webserver. I would hate to have to create an instance of IE when I dont need any kind of response and the user wont be seeing anything. I see the Inetget function but Im not trying to get a file so Im thinking posting data that way wouldnt work. The webpage is actually updateing an SQL database but Im not sure I want a few thousand PCs each opening a connection directly to the database. Anyone have a simple solution?2 ways to do it, besides the one already mentioned: 1) use IE.au3 to create an invisible instance of IE that navigates to that site then closes 2) something like this: InetGet('http://www.mydomain.com/test.asp?timestamp=whenever','deletemeonthenextline.crap') inetGetSource('http://www.mydomain.com/test.asp?timestamp=whenever','deletemeonthenextline.crap')
nimexx Posted March 13, 2007 Author Posted March 13, 2007 Thanks, I like this method but I seem to be missing something. It wont use the date/time stamp. #Include <date.au3> $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Install a custom error handler $ResolveTimeout = 5000 $ConnectTimeout = 5000 $SendTimeout = 5000 $ReceiveTimeout = 5000 $sUrl = "https://mydomain:444/timestamp.asp" $PostData = "name=test" $var=_Now() $PostData = $PostData & "&stamp=" & $var $PostData = $PostData & "&status=1" $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 = ""oÝ÷ ØàÄr^©
Hasher Posted March 13, 2007 Posted March 13, 2007 (edited) What I woud do is install fiddler for IE and do a post how you normally would with the browser. It should return a POST '200' which means its ok. This will give you a complete summary in fiddler how the post works. The most common error would be in the setup of 'content type' ....this value "application/x-www-form-urlencoded" Its a bit hard reading the code excatly how post works ( my failing) :-X Sorry thats a bit vague but best I can give ! Edited March 13, 2007 by Hasher Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of shhh extensions!
nimexx Posted March 13, 2007 Author Posted March 13, 2007 Thanks, Fiddler doesnt currently support HTTPS, I tried working around that but all I could determine is that posting via IE posted the data in the format I thought it was which doesnt tell me why its isnt working. I did realise that I could just as easily use the NOW function in ASP rather then submit the date/time and that will fix my problem.
Hasher Posted March 13, 2007 Posted March 13, 2007 Theres a work around with fiddler and https which can be found here http://www.fiddlertool.com/Fiddler/rpaspy.asp 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