Home > Software engineering >  Only download page, how to do
Only download page, how to do

Time:01-28

SZ001965
Only top row in the code. TXT

'sdata under incomplete data, the error is sdata download only part of the web page
How to download the complete web page?????????????????????????????????????????

The following is my VB6 code
Option Explicit
Private Sub Command1_Click ()
Rem===========================================================================================
'Open "error. TXT" For the Output As # 10
'Print # 10, sdata
'Close # 10
'nflag=nflag + 0
Dim nflag As Long
Dim nlable As Long 'number 601009

Dim tlable As String
Dim clable As String
Dim wlable As String
Dim plable As String 'SH SZ + 601009 + TAB
Dim mlable As String String '601009
Dim slable As String String '601009
Dim stlable As String 'original line of stock code SH601009

Dim sdata As String 'web page source code
Dim sofdata As String 'final output file
sofdatahttps://bbs.csdn.net/topics/=deposit download file name "https://bbs.csdn.net/topics/gahxqj.txt" '
Dim siflable As String 'read the code file
Tidal wave 'siflable="E: \ text and binary code \ a-share index table. TXT"
Siflable="code. TXT"
The Open siflable For Input As # 1
The Open sofdata For Output As # 2
Rem===========================================================================================
Dim QJSMSG As String 'ga tip
QJSMSG="panoramic shareholders for download:" 'download content tip
Dim qjylsof As String
Dim qjnlsof As String
Qjylsof="qjylable. TXT"
Qjnlsof="qjnlable. TXT"
Dim qjs1 As String
Dim qjs2 As String
Dim qjs0 As String
Qjs1="HTTP://http://data.p5w.net/stock/gdrs.php? Code="' url
Qjs2 url tail
="" 'Dim qjsbeg As String
Dim qjsend As String
Qjsbeg="& lt;/thead>" 'the real head
'qjsbeg="option"
Qjsend="var hqServer" entities' tail
Dim qjsbj0 As String
Dim qjsbj1 As String
Dim qjsbj2 As String
Qjsbj0="& lt; Td "c" & gt;" 'data
Qjsbj1="& lt;/td>" 'data tail
The Open qjylsof For Output As # 7 '7
The Open qjnlsof For Output As # 8 '8
Rem===========================================================================================
Do Until EOF (1)
sdatahttps://bbs.csdn.net/topics/=""
The Line Input # 1, stlable
Slable=Right (stlable, 6)
Mlable=Right (stlable, 6)
Nlable=CLng (mlable)
If (InStr (stlable, "SH") & gt; 0 And nlable & gt;=600000 And nlable & lt;=688999) Or (InStr (stlable, "SZ") & gt; 0 And ((nlable & gt;=1 And nlable & lt;=999) Or (nlable & gt;=2001 And nlable & lt;=2999) Or (nlable & gt;=300001 And nlable & lt;=300999) Or (nlable=1696 Or nlable=1872 Or nlable=1896 Or nlable=1914 Or nlable=1965 Or nlable=1979))) Then
If (nlable & gt;=600000 And nlable & lt;=688999) Then
Qjs0=qjs1 & amp; "Sh" & amp; Slable
The Else
Qjs0=qjs1 & amp; "Sz" & amp; Slable
End the If
Me. Label1. Caption=QJSMSG & amp; Slable
Sdata=https://bbs.csdn.net/topics/Inet1.OpenURL (qjs0)
'Dim (b) As Byte
'rc.inet1. Cancel
'rc.inet1. Protocol=icHTTP
'rc.inet1. URL=""' don't omit this step
'rc.inet1. URL=qjs0
'b ()=rc.inet1. OpenURL (, icByteArray)
'sdata=https://bbs.csdn.net/topics/StrConv (b, vbUnicode) is gained by the web page source code
If InStr (1, sdata qjsbeg, vbTextCompare) & gt;=1 Then
'sdata under incomplete data, so can't find qjsbeg error is sdata download only part of the web page
Nflag=InStr (1, sdata qjsbeg, vbTextCompare)
If nflag & gt; 2 Then
Sdata=https://bbs.csdn.net/topics/Right (sdata, Len (sdata) - nflag + 2)
Nflag=InStr (1, sdata qjsend, vbTextCompare)
Sdata=https://bbs.csdn.net/topics/Left (sdata nflag - 1)
End the If
Rem started
Plable=""
If (CLng (slable) & gt;=600000 And CLng (slable) & lt;=688999) Then
Plable="SH" + slable + CRH (9)
The Else
Plable="SZ" + slable + CRH (9)
End the If
Nflag=InStr (1, sdata qjsbj0, vbTextCompare)
While nflag & gt; 0
Tlable=plable
Sdata=https://bbs.csdn.net/topics/Right (sdata, Len (sdata) - nflag - Len (qjsbj0) + 1) 'section to find the characters
Tlable=tlable + Left (sdata, 4)
Tlable=tlable + Mid (sdata, 6, 2)
Tlable=tlable + Mid (sdata, 9, 2) + CRH (9)

Nflag=InStr (1, sdata qjsbj0, vbTextCompare)
Sdata=https://bbs.csdn.net/topics/Right (sdata, Len (sdata) - nflag - Len (qjsbj0) + 1)
Nflag=InStr (1, sdata qjsbj1, vbTextCompare)
Wlable=Left (sdata nflag - 1)
Wlable=Replace (wlable, ", ", "")
Tlable=tlable + wlable + CRH (9)

Nflag=InStr (1, sdata qjsbj0, vbTextCompare)
Sdata=https://bbs.csdn.net/topics/Right (sdata, Len (sdata) - nflag - Len (qjsbj0) + 1)

Nflag=InStr (1, sdata qjsbj0, vbTextCompare)
Sdata=https://bbs.csdn.net/topics/Right (sdata, Len (sdata) - nflag - Len (qjsbj0) + 1)
Nflag=InStr (1, sdata qjsbj1, vbTextCompare)
Wlable=Left (sdata nflag - 1)
Wlable=Replace (wlable, ", ", "")
Tlable=tlable + wlable


Rem sdata=https://bbs.csdn.net/topics/Right (sdata, Len (sdata) - nflag - Len (qjsbj0) + 1)
Print # 2, tlable
'nflag=InStr (1, sdata, qjsbj0 vbTextCompare)
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related