mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-16 10:53:56 +00:00
e8ebf56a2f
These tests cover basic HTTP functionality via _OPENCLIENT(), and also that it fails to work without `$Unstable:Http` in place.
30 lines
486 B
QBasic
30 lines
486 B
QBasic
$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
|
|
Print result$
|
|
|
|
Close h&
|
|
|
|
System
|