Home > Software engineering >  VBA read page data
VBA read page data

Time:09-26

Where is the error code please?

 Sub getStockData () 
Dim XMLHTTP As Object

The Set XMLHTTP=CreateObject (" Microsoft. XMLHTTP ")
XMLHTTP. Open the "POST", "http://sc.hkexnews.hk/gb/www.hkexnews.hk/sdw/search/search_sdw_c.asp", False
XMLHTTP. SetRequestHeader content-type ", "" application/x - WWW - form - urlencoded"

StrUrl="txt_today_d=25 & amp; Txt_today_m=2 & amp; Txt_today_y=2016 & amp; Current_page=1 & amp; Stock_market=HKEX& IsExist_Slt_Stock_Id=01165 & amp; IsExist_Slt_Part_Id=False& Rdo_SelectSortBy=Shareholding& Sel_ShareholdingDate_d=26 & amp; Sel_ShareholdingDate_m=02 & amp; Sel_ShareholdingDate_y=2016 & amp; SessionToken=2562.449 & amp; Txt_stock_code=00179
"XMLHTTP. Send StrUrl
Do Until XMLHTTP. ReadyState=4
DoEvents
Loop
If XMLHTTP. Then Status=200
Getpages=XMLHTTP. The responseText
If InStr (getpages, "charset=" "gb") Or InStr (getpages, "charset=gb") Then getpages=StrConv (XMLHTTP. ResponseBody vbUnicode)
The Debug. Print getpages
End the If
The Set XMLHTTP=Nothing

End Sub

CodePudding user response:

Just 2 days ago to see, to winhttp try...

CodePudding user response:

Or not, may be a string cannot pass right
StrUrl="sel_ShareholdingDate_d=25 & amp; Sel_ShareholdingDate_m=02 & amp; Sel_ShareholdingDate_y=2016 & amp; Txt_stock_code=01165 & amp; Txt_stock_name="& amp; "" & amp; "Txt_ParticipantID=" & amp; "" & amp; "Txt_Participant_name=" & amp; "
"
Please help to have a try, thank you!

CodePudding user response:

Turned out to be encrypted

CodePudding user response:

Is there a solution?

CodePudding user response:

Parameter is wrong?
People form the name="txt_stock_name" is there, but you don't contain txt_stock_name form parameter

CodePudding user response:

Can solve? I have been looking for methods,
  •  Tags:  
  • VBA
  • Related