程序代码:
CLEAR
OHTTP = CREATEOBJECT("MSXML2.XMLHTTP")
URLNAME = "https://biz./gpzy/queryStockPledgeInfo"
lcRq = "2021.02.19"
lcCode = "300056"
OHTTP.OPEN("POST", URLNAME, .F.)
OHTTP.SETREQUESTHEADER("Content-Type", "application/x-www-form-urlencoded")
OHTTP.SEND("queryDate=" + lcRq + "&secCde=" + lcCode)
IF OHTTP.STATUS = 200
lcResult = STRCONV(OHTTP.RESPONSEBODY, 11)
ELSE
MESSAGEBOX("网络故障")
RETURN
ENDIF
lcResult = STREXTRACT(lcResult, '<tr style = "font-size:12px;">' + CHR(13) + CHR(10), " </tr>" + CHR(13) + CHR(10))
ALINES(laStr1, lcResult, 4 + 1, CHR(13) + CHR(10))
lcStr = "日期,证券代码,证券简称,质押笔数,无限售股份质押数量(万),有限售股份质押数量(万),A股总股本(万),质押比例(%)"
ALINES(laStr2, lcStr, ",")
FOR lnj = 2 TO 9
?laStr2[lnj - 1] + ":" + STREXTRACT(laStr1[lnj], '>', "</td>")
ENDFOR