Top

Name

http_client — returns a varchar containing the body of the request uri

Synopsis

varchar http_client ( in url varchar ,
  in uid varchar ,
  in pwd varchar ,
  in http_method varchar ,
  in http_headers varchar ,
  in body varchar ,
  in cert_file varchar ,
  in cert_pwd varchar ,
  in timeout varchar ,
  in proxy varchar ,
  in ca_certs varchar ,
  in insecure integer ,
  in n_redirects integer );
 

Description

This function is used to perform HTTP operations to retrieve generic content and/or to perform generic operations over HTTP/HTTPS protocols. It also supports HTTP authentication based on username/password credentials.

If the URL is https: an no x509 certificate given then it will operate as https client w/o client certificate.

Parameters

url

target URL (http: or https: are supported)

uid

user name

pwd

user password

http_method

'GET', 'POST', 'HEAD' or 'PUT'

http_headers

a string containing a HTTP headers supplied by application

body

content to be sent

cert_file

cpath to the certificate file where is stored x509 certificate, private key and CA certificates

Can accept 'db:' notation, i.e. can use also keys stored in Virtuoso PKI repository.

cert_pwd

password for opening the certificate file.

timeout

use to set how many seconds to wait for reply from the client

proxy

supports:

http://[user:pass@]host:port - user & pass are optional
socks4://[user:pass@]host:port - user & pass are optional
socks5://[user:pass@]host:port - user & pass are optional
socks5-host://[user:pass@]host:port - user & pass are optional

In the INI file, in section HTTPServer should be set:

HTTPProxyServer       = proxytest:3128
HTTPProxyExceptions   = localhost:8890, 127.0.0.1:8890

Exception could be also 127.0.0.* i.e. there could have also wildcard.

ca_certs

Certificate CA. Default is null.

insecure

Sets secure or not. Default is 0.

n_redirects

By default int zero. If is given value greater than zero, so many redirects will be followed by client. Thus in pl no need to look at 30x response, just can add this number to follow the redirects.