fb:porticula NoPaste
Zufallszitat von Zitate.net (vll für IRC-bots interresant)
Uploader: | The_Muh |
Datum/Zeit: | 13.02.2009 21:52:31 |
#include once "TSNE_V3.bi"
Dim G_Client as UInteger
Declare Sub TSNE_Disconnected (ByVal V_TSNEID as UInteger)
Declare Sub TSNE_Connected (ByVal V_TSNEID as UInteger)
Declare Sub TSNE_NewData (ByVal V_TSNEID as UInteger, ByRef V_Data as String)
Dim BV as Integer
BV = TSNE_Create_Client(G_Client, "www.zitate.net", 80, 0, @TSNE_Connected, @TSNE_NewData, 60)
If BV <> TSNE_Const_NoError Then
Print "[FEHLER] " & TSNE_GetGURUCode(BV) 'Fehler ausgeben
End -1 'Programmbeenden
End If
TSNE_WaitClose(G_Client)
End
sub TSNE_Connected(ByVal V_TSNEID as UInteger)
Dim CRLF as String = Chr(13, 10)
Dim D as String
D += "GET / HTTP/1.1" & CRLF
D += "Host: zitate.net" & CRLF
D += "connection: close" & CRLF
D += CRLF
Dim BV as Integer = TSNE_Data_Send(V_TSNEID, D)
If BV <> TSNE_Const_NoError Then
Print "[FEHLER] " & TSNE_GetGURUCode(BV) 'Fehler ausgeben
End If
End Sub
Sub TSNE_NewData (ByVal V_TSNEID as UInteger, ByRef V_Data as String) 'Empfänger für neue Daten
dim position as integer = instr(v_data, "title=""Zur Detailansicht."">")
dim as string dummy, dummy2
if position then dummy = mid(v_data, position, instr(position, v_data, "</span>") - position )
dummy = right(dummy, len(dummy) - instr(dummy, ">"))
if dummy = "" then exit sub
do
if instr(dummy, "<") then
position = instr(dummy, "<")
dummy = left(dummy, position-1) & right(dummy, len(dummy) - instr(position,dummy, ">"))
else : exit do
end if
loop
position = instr(position, v_data, "<a href=""/autoren")
if position then dummy2 = mid(v_data, position, instr(position, v_data, "</a>") - position )
dummy2 = right(dummy2, len(dummy2) - instr(dummy2, ">"))
if left(dummy2, 1) = "<" then
position = instr(dummy2, "title=""")
dummy2 = right(dummy2, len(dummy2) - instr(position, dummy2, "=")-1)
dummy2 = left(dummy2, instr(dummy2, ",")-1)
end if
print dummy & chr(13,10) &" - " &dummy2
print ""
end
End Sub