- 帖子
- 16
- 主題
- 10
- 精華
- 0
- 積分
- 68
- 點名
- 0
- 作業系統
- win7
- 軟體版本
- 2003
- 閱讀權限
- 20
- 註冊時間
- 2015-2-26
- 最後登錄
- 2021-10-4
|
各位大大日安
自從證券交易所改版後
以前可以使用程式碼抓取的「個股日成交資訊」 (新網址:http://www.tse.com.tw/zh/page/trading/exchange/STOCK_DAY.html)
目前我的程式碼已無法抓取
想了許久仍無法解決
感謝高手大大了
程式碼如下
'取得近期股價 從該月第一日開始加入資料
Dim path As String, thePOSTdata, URL
Dim col As Integer, stockID As Integer, b_array, last_row As Integer
stockID = 2317 '抓鴻海股價
URL = "http://www.tse.com.tw/zh/page/trading/exchange/STOCK_DAY.html"
Set XML = CreateObject("Microsoft.XMLHTTP")
Set Stream = CreateObject("ADODB.stream")
thePOSTdata = "response=json&date=20060301&stockNo=" & stockID
XML.Open "POST", URL, 0
XML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
XML.send thePOSTdata
'MsgBox "k"
With Stream
.Type = 1
.Mode = 3
.Open
.Write XML.responseBody
.Position = 0
.Type = 2
.Charset = "Big5"
ByteToText = .ReadText
MsgBox ByteToText '使用對話框SHOW出抓到的東西都是無效的
End With |
|