程序代码:
CLEAR
lcWb = "美元"
lcWb1 = STRCONV(STRCONV(lcWb, 9), 15)
LOCAL lcToUTF8
* 转换为UTF8编码
lcUTF8 = ""
FOR ln = 1 TO LEN(lcWb1) STEP 2
lcUTF8 = lcUTF8 + "%" + SUBSTR(lcWb1, ln, 2)
ENDFOR
* 下载网页数据
oHTTP = CREATEOBJECT("MSXML2.ServerXMLHTTP") &&MSXML2.XMLHTTP/WinHttp.WinHttpRequest.5.1/MSXML2.ServerXMLHTTP/Microsoft.xmlhttp
oHTTP.Open("POST", "https://srh./search/whpj/search_cn.jsp", .F.)
OHTTP.SETREQUESTHEADER("Content-Type", "application/x-www-form-urlencoded")
lcSend = "erectDate=¬hing=&pjname=" + lcUTF8 + "&head=head_620.js&bottom=bottom_591.js"
oHTTP.Send(lcSend)
IF oHTTP.Status = 200
lcStr = oHTTP.ResponseText
ALINES(laStr, STREXTRACT(lcStr, "<tr>", "</tr>", 3), 4+1)
* 显示中行折算价
? lcWb + "中行折算价: " + SUBSTR(laStr[11], 5)
ENDIF