petyr Posted September 29, 2016 Share Posted September 29, 2016 #include <String.au3> $source = BinaryToString(InetRead("http://www.imdb.com/chart/top")) $string_arr = _StringBetween($source, '(dir.),','<span class="secondaryInfo">') For $i in $string_arr $title = _StringBetween($i, ">", "</a>") ConsoleWrite($title[0] & @CRLF) Next this script is supposed to go to IMDb website, collect the names of top 250 rated movies, and write their names to console. It works fine, except for one thing, it writes the names of movies in my language, and I want it to write them in English English is set as default language for all my browsers, so I guess is has to do something with AutoIt preferences! Anyone experienced something similar? Link to comment Share on other sites More sharing options...
genius257 Posted September 30, 2016 Share Posted September 30, 2016 (edited) InetRead is fine for basic use, but winhttprequest is better for something like this ; Creating the object $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET", "http://www.imdb.com/chart/top", False) $oHTTP.SetRequestHeader("Accept-Language", "en") ; Performing the Request $oHTTP.Send() ; Download the body response if any, and get the server status response code. $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status FileWrite("imdb.html", $oReceived) Edited September 30, 2016 by genius257 My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser Link to comment Share on other sites More sharing options...
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