Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
33
Task/HTTP/FreeBASIC/http-2.basic
Normal file
33
Task/HTTP/FreeBASIC/http-2.basic
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#include once "windows.bi"
|
||||
#include once "win/wininet.bi"
|
||||
|
||||
' Create InternetOpen and InternetConnect objects
|
||||
Dim As HINTERNET hInternet, hConnect, hRequest
|
||||
Dim As String dato
|
||||
Dim As Byte buffer(4096)
|
||||
Dim As DWORD dwRead
|
||||
|
||||
' Initialize Internet connection
|
||||
hInternet = InternetOpen("FreeBASIC", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0)
|
||||
hConnect = InternetConnect(hInternet, "www.example.com", INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0)
|
||||
|
||||
' Open request
|
||||
hRequest = HttpOpenRequest(hConnect, "GET", "/index.html", NULL, NULL, NULL, INTERNET_FLAG_SECURE, 0)
|
||||
|
||||
' Send request
|
||||
HttpSendRequest(hRequest, NULL, 0, NULL, 0)
|
||||
|
||||
' Read response
|
||||
While InternetReadFile(hRequest, @buffer(0), Sizeof(buffer), @dwRead) And dwRead > 0
|
||||
dato &= *Cast(zstring Ptr, @buffer(0))
|
||||
Wend
|
||||
|
||||
' Print response
|
||||
Print dato
|
||||
|
||||
' Clean up
|
||||
InternetCloseHandle(hRequest)
|
||||
InternetCloseHandle(hConnect)
|
||||
InternetCloseHandle(hInternet)
|
||||
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue