Seite 1 von 1
Laden und Auswerten einer Internetseite
Verfasst: 08.09.2015 17:43
von argus
Hallo zusammen,
wie kann man das Laden und Auswerten einer Internetseite im Hintergrund bewerkstelligen? Die implementierten Funktionen (wie z.B. ReceiveHTTPFile, ReceiveNetworkData, etc.) liefern nicht das gewünschte Ergebnis oder ich mache etwas falsch. Ich suche eine Routine, die eine HTML-Datei einer URL in eine Variable liest, die man dann anschließend lesen und auswerten kann.
Viele Grüße von
Argus
Re: Laden und Auswerten einer Internetseite
Verfasst: 08.09.2015 18:14
von GPI
Das wird wohl erst mit 5.40 unterstützt, zumindest gibt es laut englischer Hilfe:
Code: Alles auswählen
Syntax
Result = HTTPProgress(HttpConnection)
Description
Returns the progress of the specified asynchronous download, started either with ReceiveHTTPFile() or ReceiveHTTPMemory().
Parameters
HttpConnection The HTTP connection to monitor.
Return value
The status of the download. It can be the current number of recieved bytes or one of the following value:
#PB_Http_Success : the download has been successfully finished.
#PB_Http_Failed : the download has failed.
#PB_Http_Aborted : the download has been aborted with AbortHTTP().
Example
InitNetwork()
Download = ReceiveHTTPMemory("http://www.purebasic.com/download/OgreAssimpConverter.zip", #PB_HTTP_Asynchronous)
If Download
Repeat
Progress = HTTPProgress(Download)
Select Progress
Case #PB_Http_Success
*Buffer = FinishHTTP(Download)
Debug "Download finished (size: " + MemorySize(*Buffer) + ")"
FreeMemory(*Buffer)
End
Case #PB_Http_Failed
Debug "Download failed"
End
Case #PB_Http_Aborted
Debug "Download aborted"
End
Default
Debug "Current download: " + Progress
EndSelect
Delay(500) ; Don't stole the whole CPU
ForEver
Else
Debug "Download error"
EndIf
See Also
ReceiveHTTPFile(), ReceiveHTTPMemory()
Supported OS
All