GyroHttpRequest Class Reference
[Lib]
Download files using http protocols. More...
Static Public Member Functions |
|
static | get_content ($url, $err=null, $timeout=30, $policy=self::NONE, &$info=false) |
Read content from given url. |
|
static | get_content_with_auth ($url, $user, $pwd, $err=null, $timeout=30, $policy=self::NONE, &$info=false) |
Read content from given url using
authentication. |
|
static | get_head ($url, $err=null, $timeout=30, $policy=self::NONE) |
Fetch only head. |
|
static | site_exists ($url) |
Starts a header-request and returns true if
site exists otherwise returns false. |
|
Public Attributes |
|
const | NO_ERROR_ON_4XX_5XX = 2 |
const | NONE = 0 |
const | SSL_NO_VERIFY = 1 |
Detailed Description
Download files using http protocols.
- Note:
- The class uses CURL, so the php bindings for PHP should be installed. See http://www.php.net/manual/en/curl.installation.php
Definition at line 12 of file httprequest.cls.php.
Member Function Documentation
static GyroHttpRequest::get_content | ( | $ | url, | |
$ | err = null , |
|||
$ | timeout = 30 , |
|||
$ | policy =
self::NONE , |
|||
&$ | info = false |
|||
) | [static] |
Read content from given url.
- Parameters:
-
string|Url $url URL to invoke Status $err Set to errors if any int $timeout Timeout in seconds int $policy Policy. Either NONE or SSL_NO_VERIFY array $info Set to CURL info array. See http://www.php.net/manual/de/function.curl-getinfo.php
- Returns:
- String The content of the file or NULL, if file was not found
Definition at line 27 of file httprequest.cls.php.
static GyroHttpRequest::get_content_with_auth | ( | $ | url, | |
$ | user, | |||
$ | pwd, | |||
$ | err = null , |
|||
$ | timeout = 30 , |
|||
$ | policy =
self::NONE , |
|||
&$ | info = false |
|||
) | [static] |
Read content from given url using authentication.
- Parameters:
-
string|Url $url URL to invoke string $user Username for authentication string $pwd Password for authentication Status $err Set to errors if any int $timeout Timeout in seconds int $policy Policy. Either NONE or SSL_NO_VERIFY array $info Set to CURL info array. See http://www.php.net/manual/de/function.curl-getinfo.php
- Returns:
- String The content of the file or NULL, if file was not found
Definition at line 45 of file httprequest.cls.php.
static GyroHttpRequest::get_head | ( | $ | url, | |
$ | err = null , |
|||
$ | timeout = 30 , |
|||
$ | policy =
self::NONE |
|||
) | [static] |
Fetch only head.
- Parameters:
-
Url|string $url Status $err int $timeout
- Returns:
- string Content fetched or false on error
Definition at line 60 of file httprequest.cls.php.
00060 { 00061 $options = self::get_default_opts($policy); 00062 //curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD'); 00063 $options[CURLOPT_HEADER] = 1; 00064 // NOBODY turns GET into HEAD, though it is not documented 00065 // explicitely 00066 $options[CURLOPT_NOBODY] = 1; 00067 $ret = self::execute_curl($url, $options, $timeout, $err); 00068 return $ret; 00069 }
static GyroHttpRequest::site_exists | ( | $ | url | ) | [static] |
Starts a header-request and returns true if site exists otherwise returns false.
- Returns:
- boolean
Definition at line 76 of file httprequest.cls.php.
00076 { 00077 $ret = self::get_head($url); 00078 return !empty($ret); 00079 }
Member Data Documentation
const GyroHttpRequest::NO_ERROR_ON_4XX_5XX = 2 |
Definition at line 15 of file httprequest.cls.php.
const GyroHttpRequest::NONE = 0 |
Definition at line 13 of file httprequest.cls.php.
const GyroHttpRequest::SSL_NO_VERIFY = 1 |
Definition at line 14 of file httprequest.cls.php.
The documentation for this class was generated from the following file:
- gyro/core/lib/components/httprequest.cls.php