BE_HTTP_GET
BE_HTTP_GET(url;{filename;username;password })
Does a http GET function and returns the results. This uses the curl library so output will be similar to that. This is used in conjunction with the BE_HTTP_SetCustomHeader function to set custom headers in advance and the BE_HTTP_ResponseCode and BE_HTTP_ResponseHeaders functions to get the result values after the GET is complete.
Parameters:
- url : the url to retrieve.
- filename : Required if you're saving the contents of the url ( i.e. text or a file ) into a container field. The container field uses the name supplied here for the name of the resulting file.
- username : The username if the url requires authentication.
- password : The password if the url requires authentication.
Keywords:
HTTP GET
Version History:
- 1.2 :
- 3.3.0 : Renamed to BE_HTTP_GET from BE_GetURL
Notes:
- Check for errors using theBE_GetLastErrorfunction and use https://curl.haxx.se/libcurl/c/libcurl-errors.html for error details.
- Some useful header options :
BE_CurlSetOption ( "CURLOPT_FOLLOWLOCATION" ; 1 ) will mean that it will follow a 301 redirect.
BE_CurlSetOption ( "CURLOPT_HTTPAUTH" ; 1 ) forces Basic auth for some sites that won't work with the defaults.
This function can also be used for FTP by using ftp:// urls. For example :
BE_HTTP_GET ( "sftp://server/path/file.txt" ; "" ;
;
)
and
BE_CurlSetOption ( "CURLOPT_DIRLISTONLY" ; 1 )
BE_HTTP_GET ( "sftp://server/path/" ; "" ;
;
)
to get a file listing at that path.