1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-09-04 11:10:15 +00:00
QB64-PE/tests/compile_tests/http/read_example.bas

32 lines
525 B
QBasic
Raw Normal View History

$Unstable:Http
$Console:Only
h& = _OpenClient("https://www.example.com")
Print h&
length~& = LOF(h&)
result$ = ""
While Not Eof(h&)
_Limit 100
GET #h&, , s$
result$ = result$ + s$
Wend
' Strip off the trailing slash if it's there to make the result consistent
url$ = _ConnectionAddress$(h&)
If MID$(url$, LEN(url$), 1) = "/" Then
url$ = Left$(Url$, LEN(url$) - 1)
End If
Print "Content-Length: "; length~&
Print "Url: "; url$
Print "Status Code: "; _StatusCode(h&)
Print
Print result$
Close h&
System