string QueryGetData( string site, int port, string page, string query, int &error_number, string &error_text, string http_method = "GET", string site_prefix = "" )
The function QueryGetData queries the specified web address using the HTTP protocol. Returns the server response body without header. If an error occurres, the function returns an empty string and set parameters error_number and error_text.
Parameter | Description |
---|---|
site | Address of the site to query. |
port | Port number. Usually 80. |
page | Path to the requested page. |
query | String with the query parameters in the common format. |
error_number | Reference to a variable that receives the error number on failure. |
error_text | Reference to a variable that receives the error description on failure. |
http_method | Method to use for querying the remote server. The following values are possible:
|
site_prefix | Site address prefix for work through SSL or TLS. The following values are possible:
Note |
<? // Query for currency exchange rates from www.cbr.ru on 18.01.2005 $strQueryText = QueryGetData( "www.cbr.ru", 80, "/scripts/XML_daily.asp", "date_req=18.01.2005", $error_number, $error_text ); if (strlen($strQueryText)<=0) { echo "Query error!"; if (intval($error_number)>0 || strlen($error_text)>0) echo ": (".$error_number.") ".$error_text; echo ". "; } else { echo htmlspecialchars($strQueryText); } ?>
© 2001-2005 Bitrix | Bitrix Site Manager - Content Management & Portal Solutions |