Jump to content

InetRead()


petyr
 Share

Recommended Posts

#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

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 by genius257
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...