Previous section To contents Next section

14.25 Protocols.HTTP

METHOD
Protocols.HTTP.delete_url

SYNTAX
object(Protocols.HTTP.Query) delete_url(string url)
object(Protocols.HTTP.Query) delete_url(string url, mapping query_variables)
object(Protocols.HTTP.Query) delete_url(string url, mapping query_variables,  mapping request_headers)

DESCRIPTION
Sends a HTTP DELETE request to the server in the URL and returns the created and initialized Query object. 0 is returned upon failure.

METHOD
Protocols.HTTP.get_url

SYNTAX
object(Protocols.HTTP.Query) get_url(string url)
object(Protocols.HTTP.Query) get_url(string url, mapping query_variables)
object(Protocols.HTTP.Query) get_url(string url, mapping query_variables,  mapping request_headers)

DESCRIPTION
Sends a HTTP GET request to the server in the URL and returns the created and initialized Query object. 0 is returned upon failure.

METHOD
Protocols.HTTP.get_url_nice,
Protocols.HTTP.get_url_data

SYNTAX
array(string) get_url_nice(string url)
array(string) get_url_nice(string url, mapping query_variables)
array(string) get_url_nice(string url, mapping query_variables,  mapping request_headers)
string get_url_data(string url)
string get_url_data(string url, mapping query_variables)
string get_url_data(string url, mapping query_variables,  mapping request_headers)

DESCRIPTION
Returns an array of ({content_type,data}) and just the data string respective, after calling the requested server for the information. 0 is returned upon failure.

METHOD
Protocols.HTTP.http_encode_query

SYNTAX
string http_encode_query(mapping variables)

DESCRIPTION
Encodes a query mapping to a string; this protects odd - in http perspective - characters like '&' and '#' and control characters, and packs the result together in a HTTP query string.

Example:

> Protocols.HTTP.http_encode_query( (["anna":"eva","lilith":"blue"]) );
Result: "lilith=blue&anna=eva"
> Protocols.HTTP.http_encode_query( (["&":"&","'=\"":"\0\0\0"]) );
Result: "%26amp%3b=%26&%27%3d%22=%00%00%00"

METHOD
Protocols.HTTP.http_encode_string

SYNTAX
string http_encode_string(string in)

DESCRIPTION
This protects all odd - see http_encode_query - characters for transfer in HTTP.

Do not use this function to protect URLs, since it will protect URL characters like '/' and '?'.

METHOD
Protocols.HTTP.post_url_data,
Protocols.HTTP.post_url,
Protocols.HTTP.post_url_nice

SYNTAX
array(string) post_url_nice(string url, mapping query_variables)
array(string) post_url_nice(string url, mapping query_variables,  mapping request_headers)
string post_url_data(string url, mapping query_variables)
string post_url_data(string url, mapping query_variables,  mapping request_headers)
object(Protocols.HTTP.Query) post_url(string url, mapping query_variables)
object(Protocols.HTTP.Query) post_url(string url, mapping query_variables,  mapping request_headers)

DESCRIPTION
Similar to the get_url class of functions, except that the query variables is sent as a post request instead of a get.

METHOD
Protocols.HTTP.put_url

SYNTAX
object(Protocols.HTTP.Query) put_url(string url)
object(Protocols.HTTP.Query) put_url(string url, string file)
object(Protocols.HTTP.Query) put_url(string url, string file, mapping query_variables)
object(Protocols.HTTP.Query) put_url(string url, string file, mapping query_variables,  mapping request_headers)

DESCRIPTION
Sends a HTTP PUT request to the server in the URL and returns the created and initialized Query object. 0 is returned upon failure.

METHOD
Protocols.HTTP.unentity

SYNTAX
string unentity(string s)

DESCRIPTION
Helper function for replacing HTML entities with the corresponding iso-8859-1 characters.

NOTE
All characters isn't replaced, only those with corresponding iso-8859-1 characters.

14.25.1 Protocols.HTTP.Query


Previous section To contents Next section