想下这个网站数据,完全搞不定啊,有没有哪位大能帮帮?
想下这个数据到VFP,翻了以前有关的帖子,完全看不懂语句含义!,彻底搞不定。http://data.
有没有哪位大能帮帮?
只查出来对应链接:
"http://data.。 对应第一页
http://data.
用/page/2..../page/6 的变化对应第二到第六页
ie = CREATEOBJECT("internetexplorer.application") page = 0 DO WHILE .t. page = page + 1 ie.Navigate("http://data./market/xsjj/field/enddate/order/desc/ajax/1/free/1/page/"+TRANSFORM(page)+"/free/1/") DO WHILE ie.Busy OR ie.ReadyState!=4 ?? " 请稍候 ...... "+TRANSFORM(page),TIME()+0h0D INKEY(1) ENDDO IF VARTYPE(ie.document)!="O" LOOP ENDIF tbody = ie.document.getElementsByTagName("tbody").[0] IF tbody.rows.length == 0 EXIT ENDIF IF page==1 thead = ie.document.getElementsByTagName("thead").[0] cmd = "" FOR EACH th IN thead.rows[0].cells fieldName = STRTRAN(th.innertext, 0h0D0A,"") fieldName = STRTRAN(fieldName,"%","%") cmd = cmd + "," + fieldName + " c(20)" ENDFOR cmd = "CREATE CURSOR tt (" + SUBSTR(cmd,2) + ")" EXECSCRIPT(cmd) ENDIF FOR EACH row IN tbody.rows cmd = "" FOR EACH cell IN row.cells cmd = cmd + ",'" + cell.innertext + "'" ENDFOR cmd = "INSERT INTO tt VALUES (" + SUBSTR(cmd,2) + ")" EXECSCRIPT(cmd) ENDFOR ENDDO ie.quit() SELECT * FROM tt
CREATE CURSOR ths (序号 C(4), 股票代码 C(6), 股票简称 C(20), 限售解禁日期 C(10), 本期解禁数(股) C(20), 最新价 C(10), 解禁股市值(元) C(20), 占总股本比例(%) C(6), 是否为实际值 C(2)) FOR lns = 1 TO 6 lcUrl = "http://data./market/xsjj/field/enddate/order/desc/ajax/1/free/1/page/" + TRANSFORM(lns) + "/free/1/" lcText = GETURL(lcUrl) IF EMPTY(lcText) MESSAGEBOX("网络错误......") RETURN ENDIF lcText = STREXTRACT(lcText, " <tbody>" + CHR(13)+CHR(10), " </tbody>") ALINES(laText, lcText, 5, "<tr >" + CHR(13)+CHR(10), "<!", '<tr class="even">' + CHR(13)+CHR(10)) FOR ln = 2 TO ALEN(laText) STEP 2 ALINES(laStr, laText[ln]) INSERT INTO ths VALUES (STREXTRACT(laStr[1], ">", "</td>"),; STREXTRACT(laStr[2], ">", "</a></td>", 2),; STREXTRACT(laStr[3], ">", "</a></td>", 2),; STREXTRACT(laStr[4], ">", "</td>"),; STREXTRACT(laStr[5], ">", "</td>"),; STREXTRACT(laStr[6], ">", "</td>"),; STREXTRACT(laStr[7], ">", "</td>"),; STREXTRACT(laStr[8], ">", "</td>"),; STREXTRACT(laStr[9], ">", "</td>")) ENDFOR ENDFOR BROWSE RETURN FUNCTION GETURL(UrlName) lcStr = "" oHTTP = CREATEOBJECT("WinHttp.WinHttpRequest.5.1") oHTTP.Open("GET", UrlName, .F.) oHTTP.SetRequestHeader("hexin-v", "A9h0LUHLDmk4dCLttBje8OMjqQ1lwT1XnicQyhLJJW7EKXZxutEM2-414Fth") oHTTP.Send() IF oHTTP.Status = 200 lcStr = oHTTP.ResponseText ENDIF RELEASE oHTTP RETURN lcStr ENDFUNC
[此贴子已经被作者于2022-7-16 18:22编辑过]