(Windows only) This routine handles various kinds of HTTP requests:
xcall HTTP, op, status, flags, url, request, response
Parameters
op (Num) [in]
1 (XHTTPOP_REQ) = general HTTP request
status (Signed num) [out]
0 = ok (for simple functions)
>0 = response code returned from HTTP server (generally means that operation succeeded in communicating with the server; whether that represents an unqualified success will depend on the application and the body of the response.)
<0 = Operational errors (see ASHINC:HTTP.DEF HTTPERR_xxx)
flags (Num) [in]
sum of options flags. These flags are listed in ASHINC:HTTP.DEF.
Symbol |
Value |
Description |
---|---|---|
XHTTPF_SSL |
&h0001 |
Use SSL |
XHTTPF_REQPOST |
&h0002 |
Tells upload routine to use POST format |
XHTTPF_REQUPLOAD |
&h0004 |
Upload files (variation of POST) |
XHTTPF_REQHEAD |
&h0008 |
Makes the request a HEAD request |
XHTTPF_REQXML |
&h0010 |
Makes the request a POST using text/xml content |
XHTTPF_REQGET |
&h0020 |
Simple GET (text of HTML page) |
XHTTPF_REQPUT |
&h0040 |
Simple PUT |
XHTTPF_DOWNLOAD |
&h0080 |
Download a file |
XHTTPF_FILEREQ |
&h0100 |
Request arg is a filespec (or list of) not a string |
XHTTPF_FILERESP |
&h0200 |
Response arg is a filespec not a buffer |
XHTTPF_DEBUG |
&h0400 |
Outputs copy of generated request to DEBUG.REQ |
XHTTPF_HDRBODY |
&h0800 |
Parse file into headers (added individually) and body |
XHTTPF_PARMBODY |
&h1000 |
Like HDRBODY but use AddParam instead of AddHeader |
XHTTPF_SETFROMURL |
&h2000 |
Extract path and form info from URL |
XHTTPF_FORCEXFR |
&h4000 |
File parms are server-relative; transfer to PC |
url (Str) [in]
Fully qualified URL, with optional path and/or {:port}. For example:
"http://www.microsabio.net/dist/51dev/temphold/junk.zip"
"https://www.paypal.com"
"http://someserver.com/some/path:10080"
request (Str) [in]
Contains content of the request, for operations that require it, such as uploading files, POST, etc. Depending on XHTTPF_FILEREQ flag, may be a string buffer or a filespec (preferably native). For the XHTTPF_REQUPLOAD option, can be a list of filespecs with semi-colon delimiter. Note that some options only work with file mode, while some may only work with string mode.
response (Str) [in/out]
Body of the response. Depending on XHTTPF_FILERESP, it is the filespec (preferably native) of a file, or a string buffer to return the response in. For errors that return STATUS<0, it may contain debugging text about the error rather than the actual response.
Comments
If intending to routine this via ATE from a UNIX server, you should stick with the file mode.