Private Function GetInfo() As Boolean
Dim strWebPage As String
Dim strRequest As String
strWebPage = "http://www.xxxxxxxxxxx.htm"
On Error GoTo Label1
objHTTP.open "GET", strWebPage, False
objHTTP.send
If objHTTP.Status <> "200" Then
GetInfo = False
Exit Function
End If
strRequest = objHTTP.responseText
GetInfo = True
Exit Function
Label1:
GetInfo = False
End Function
Private Sub Command1_Click()
Dim Data As Variant
Dim data_str As String
Data = Inet.OpenURL("http://kovcheg.apeha.ru/info.html?user=100116177", icString)
data_str = CStr(Data)
RichTextBox1.Text = data_str
End Sub
Private Sub Form_Load()
Dim str As String
Dim res As String
Dim spos As Long
'Положение начала текста
Dim START As Long
'Положение конца текста
Dim FINISH As Long
'Номер строки, в которой интересующее значение
Dim STR_NUMBER As Long
Dim i As Long
str = "gggggg" & vbCrLf & "dasdsaa" & vbCrLf & "fsaeqweqeqeq" & vbCrLf & "secret=2" '(например)
STR_NUMBER = 3
START = 7
FINISH = 8
For i = 1 To STR_NUMBER
spos = InStr(spos + 1, str, vbCrLf)
Next i
res = Mid$(str, spos + 2 + START, FINISH - START)
MsgBox res
'Должно получиться "2" в сообщении :)
End Sub
Private Sub Command2_Click()
Dim Data As Variant
Data = Inet.OpenURL("http://kovcheg.apeha.ru/info.html?user=100116177", icString)
Dim data_str As Variant
data_str = CVar(Data)
RichTextBox1.Text = data_str
Dim res As String
Dim spos As Long
'Ïîëîæåíèå íà÷àëà òåêñòà
Dim START As Long
'Ïîëîæåíèå êîíöà òåêñòà
Dim FINISH As Long
'Íîìåð ñòðîêè, â êîòîðîé èíòåðåñóþùåå çíà÷åíèå
Dim STR_NUMBER As Long
Dim i As Long
Dim str As String
str = data_str
STR_NUMBER = 23
START = 1
FINISH = 14
For i = 1 To STR_NUMBER
spos = InStr(spos + 1, str, vbCrLf)
Next i
res = Mid$(str, spos + 2 + START, FINISH - START)
MsgBox res
'Äîëæíî ïîëó÷èòüñÿ "2" â ñîîáùåíèè :)
End Sub
For i = 1 To STR_NUMBER
spos = InStr(spos + 1, str, vbCrLf)
Next i
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 108