string site,
  int port,
  string PATH,
  string QUERY_STR,
  int &errno,
  string &errstr,
  string Method = "GET",
  string Proto = "",
  string ContentType = 'N'

This function retrieves a web address specified in the parameters via HTTP protocol. Returns a body (without title) of the reply, received from server. Empty string is returned on failure and error_number and error_text parameters are set.

Function parameters

ParameterDescription Available from version
site Site address, which page is requested.
port Port number. As a rule - 80.
PATH Path to requested page.
QUERY_STR String with query parameters in standard format.
errno This parameter is the reference to an original variable. This variable receives an error number if it has occurred.
errstr This parameter is the reference to original variable. It receives an error text if it has occurred.
Method Method to send query to a remote server. Available values:
  • "GET"
  • "POST"
Optional parameter, set to GET by default.
Proto Prefix for site address to work with SSL and TLS. Available values:
  • ""
  • "ssl://"
  • "tls://"
Optional parameter, by default equals to "" (empty string) - standard connection.

Your hosting May not support connections different from standard.

ContentType Optional, by default "N".

Examples of use

// Query the currency rates for 18 January 2005 from the site of US central bank
$strQueryText = QueryGetData(
if (strlen($strQueryText)<=0)
   echo "Currency rates request error";
   if (intval($error_number)>0 || strlen($error_text)>0)
      echo ": (".$error_number.") ".$error_text;
   echo ". ";
   echo htmlspecialchars($strQueryText);

© «Bitrix24», 2001-2023