0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

vbsの作法 その24

Posted at

概要

vbsの作法調べてみた。
html取得、やってみた。

サンプルコード

Function GetHtml(url)
	Const adTypeBinary = 1
	Const adTypeText = 2
	Dim oHttpReq, oStream
	Dim sText
	Set oHttpReq = CreateObject("MSXML2.ServerXMLHTTP.3.0")
	oHttpReq.Open "GET", url, False
	oHttpReq.Send
	Set oStream = CreateObject("ADODB.Stream")
	oStream.Open
	oStream.Type = adTypeBinary
	oStream.Write oHttpReq.ResponseBody
	oStream.Position = 0
	oStream.Type = adTypeText
	oStream.Charset = "Shift-JIS"
	sText = oStream.ReadText
	oStream.Close
	GetHtml = sText
End Function

Dim html
html = GetHtml("http://jsdo.it")
msgbox html


以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?