Set Stream = CreateObject( "ADODB.Stream" ) Set Fso = CreateObject( "Scripting.FileSystemObject" ) strUrlTarget = "http://hp.vector.co.jp/authors/VA003334/" Set Http = CreateObject("Msxml2.XMLHTTP.3.0") Call Http.Open("GET", strUrlTarget, FALSE ) ' FALSE は同期処理 Http.Send Stream.Open Stream.Type = 1 ' バイナリ Stream.Write Http.responseBody ' Write はバイナリ用 Stream.SaveToFile "Shift_Jis_Page.txt", 2 Stream.Close Set objHandle = Fso.OpenTextFile( "Shift_Jis_Page.txt", 1 ) For I = 1 to 30 WScript.Echo objHandle.ReadLine Next objHandle.Close
Set Stream = CreateObject( "ADODB.Stream" ) strUrlTarget = "http://euc-jpまたはutf-8ベージのURL" Set Http = CreateObject("Msxml2.XMLHTTP.3.0") Call Http.Open("GET", strUrlTarget, FALSE ) ' FALSE は同期処理 Http.Send Stream.Open Stream.Type = 2 ' テキスト Stream.WriteText Http.responseText ' WriteText はテキスト用 Stream.Position = 0 Stream.LineSeparator = 10 ' LF For I = 1 to 30 WScript.Echo Stream.ReadText( -2 ) Next Stream.Close
Set Stream = CreateObject( "ADODB.Stream" ) strUrlTarget = "http://euc-jpまたはutf-8ベージのURL" Set Http = CreateObject("Msxml2.XMLHTTP.3.0") Call Http.Open("GET", strUrlTarget, FALSE ) ' FALSE は同期処理 Http.Send Stream.Open Stream.Type = 2 ' テキスト Stream.WriteText Http.responseText ' WriteText はテキスト用 Stream.SaveToFile "Save_As_Unicode.txt", 2 Stream.Close
Set Stream = CreateObject( "ADODB.Stream" ) strUrlTarget = "http://euc-jpまたはutf-8ベージのURL" Set Http = CreateObject("Msxml2.XMLHTTP.3.0") Call Http.Open("GET", strUrlTarget, FALSE ) ' FALSE は同期処理 Http.Send Stream.Open Stream.Type = 2 ' テキスト Stream.Charset = "shift_jis" 'Stream.Charset = "euc-jp" 'Stream.Charset = "utf-8" Stream.WriteText Http.responseText ' WriteText はテキスト用 Stream.SaveToFile "Save_As_Not_Unicode.txt", 2 Stream.Close