STATUSCODE: Difference between revisions
Jump to navigation
Jump to search
Code by Matthew Kilgore
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
(Created page with "{{DISPLAYTITLE:_STATUSCODE}} '''_STATUSCODE''' gives the HTTP status code of an HTTP response that was opened using _OPENCLIENT. {{Text|'''HTTP functionality is current unstable, and requires $UNSTABLE:HTTP to be able to use.'''|red}} {{PageSyntax}} : ''_STATUSCODE''({{Parameter|Handle}}) {{PageParameters}} * {{Parameter|Handle}} is the handle returned from _OPENCLIENT when making an HTTP request. {{PageDescription}} '''_STATUSCODE''' is used to get the H...") |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
{{Text|'''HTTP functionality is current unstable, and requires [[$UNSTABLE]]:HTTP to be able to use.'''|red}} | {{Text|'''HTTP functionality is current unstable, and requires [[$UNSTABLE]]:HTTP to be able to use.'''|red}} | ||
{{PageSyntax}} | {{PageSyntax}} | ||
: | : [[_STATUSCODE]]({{Parameter|Handle}}) | ||
{{PageParameters}} | {{PageParameters}} | ||
* {{Parameter|Handle}} is the handle returned from [[_OPENCLIENT]] when making an HTTP request. | * {{Parameter|Handle}} is the handle returned from [[_OPENCLIENT]] when making an HTTP request. | ||
{{PageDescription}} | {{PageDescription}} | ||
'''_STATUSCODE''' is used to get the HTTP status code returned on an HTTP response. A list of HTTP status codes can be read [ | '''_STATUSCODE''' is used to get the HTTP status code returned on an HTTP response. A list of HTTP status codes can be read [[Wikipedia:List of HTTP status codes|here]], generally speaking codes in the 200 range indicate success, 400 range indicates a client error, and 500 range indicate a server error. | ||
{{PageAvailability}} | {{PageAvailability}} | ||
* '''QB64-PE v3.5.0 and up''' | * '''QB64-PE v3.5.0 and up''' | ||
{{PageExamples}} | {{PageExamples}} | ||
{{CodeStart}} | {{CodeStart}} | ||
{{Cl|$UNSTABLE}}: | {{Cl|$UNSTABLE}}:HTTP | ||
' This URL simply returns a fake JSON response | ' This URL simply returns a fake JSON response | ||
h& = {{Cl|_OPENCLIENT}}("HTTP:https://httpbin.org/json") | h& = {{Cl|_OPENCLIENT}}("HTTP:<nowiki>https://httpbin.org/json</nowiki>") | ||
' Print the status code on the HTTP response | ' Print the status code on the HTTP response | ||
Line 29: | Line 34: | ||
{{CodeEnd}} | {{CodeEnd}} | ||
{{Small|Matthew Kilgore}} | {{Small|Code by Matthew Kilgore}} | ||
{{OutputStartBG0}} | {{OutputStartBG0}} | ||
Line 35: | Line 40: | ||
{{OutputEnd}} | {{OutputEnd}} | ||
{{PageNavigation}} | {{PageNavigation}} |
Latest revision as of 16:33, 14 June 2024
_STATUSCODE gives the HTTP status code of an HTTP response that was opened using _OPENCLIENT.
HTTP functionality is current unstable, and requires $UNSTABLE:HTTP to be able to use.
Syntax
- _STATUSCODE(Handle)
Parameters
- Handle is the handle returned from _OPENCLIENT when making an HTTP request.
Description
_STATUSCODE is used to get the HTTP status code returned on an HTTP response. A list of HTTP status codes can be read here, generally speaking codes in the 200 range indicate success, 400 range indicates a client error, and 500 range indicate a server error.
Availability
- QB64-PE v3.5.0 and up
Examples
$UNSTABLE:HTTP ' This URL simply returns a fake JSON response h& = _OPENCLIENT("HTTP:https://httpbin.org/json") ' Print the status code on the HTTP response PRINT _STATUSCODE(h&) CLOSE h& |
200 |