|
楼主 |
发表于 2014-10-28 22:10
|
显示全部楼层
Sub main() '主體代碼
Dim strText As String
Dim strcookie As String
On Error Resume Next
With CreateObject("WinHttp.WinHttpRequest.5.1")
.Open "POST", "http://www.hkexnews.hk/sdw/search/search_sdw_c.asp", False
.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded; charset=big5"
.send "txt_today_d=28&txt_today_m=10&txt_today_y=2014¤t_page=1&stock_market=HKEX&IsExist_Slt_Stock_Id=False&IsExist_Slt_Part_Id=False&rdo_SelectSortBy=Shareholding&sel_ShareholdingDate_d=27&sel_ShareholdingDate_m=10&sel_ShareholdingDate_y=2014&txt_stock_code=08056&txt_stock_name=&txt_ParticipantID=&txt_Participant_name="
CopyToClipbox BytesToBstr(.responseBody, "BIG5")
End With
End Sub
Function BytesToBstr(strBody, CodeBase) '使用Adodb.Stream?象提取字符串
Dim objStream
On Error Resume Next
Set objStream = CreateObject("Adodb.Stream")
With objStream
.Type = 1
.Mode = 3
.Open
.write strBody
.Position = 0
.Type = 2
.Charset = CodeBase
BytesToBstr = .ReadText
End With
objStream.Close
Set objStream = Nothing
If Err.Number <> 0 Then BytesToBstr = ""
On Error GoTo 0
End Function
想問問,中間那句 CopyToClipbox BytesToBstr(.responseBody, "BIG5") 如果變成 CopyToClipbox BytesToBstr(.responseText, "BIG5") 這樣便拿不到內文,請問是什麼問題呢? |
|