DTheory Posted April 23, 2011 Posted April 23, 2011 Hello everyone, i recently started using autoit so i'm pretty nub and i'm going to ask a _maybe_ nub questionI made this script which reads the source of a webpage after sending some info through a POST string:;//Open $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", $address, true) ;//Request $oHTTP.SetRequestHeader("Referer", $address) $oHTTP.SetRequestHeader("Accept-Languag", "it") $oHTTP.SetRequestHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)") $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $oHTTP.SetRequestHeader("Host", $host) $oHTTP.SetRequestHeader("Content-Length", "42") $oHTTP.SetRequestHeader("Connection", "Keep-Alive") $oHTTP.SetRequestHeader("Cookie", $cookiesend) $oHTTP.Send($send) ;//Answer $HTMLSource = $oHTTP.ResponsetextWell, everything works properly for some pages, but for other pages it says:: ==> The requested action with this object has failed.:$HTMLSource = $oHTTP.Responsetext$HTMLSource = $oHTTP.Responsetext^ ERRORThe only one things that changes in the responses between the first pages i tried to open (succesfully) and the other pages is the charset:Working: Content-Type: text/html; charset=utf-8Not working: Content-Type: text/html; charset=utf8My questions are:-is this the 'difference' that gives the 'fail' error?-is there a way to solve the problem? (maybe converting from utf8 => utf-8?)Thanks!
DTheory Posted April 23, 2011 Author Posted April 23, 2011 (edited) Solved using $ohttp.responseBODY instead of TEXT, thx anyway Edited April 23, 2011 by DTheory
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