class FeedsHTTPFetcherResult in Feeds 7.2
Result of FeedsHTTPFetcher::fetch().
Hierarchy
- class \FeedsResult
- class \FeedsFetcherResult
- class \FeedsHTTPFetcherResult
- class \FeedsFetcherResult
Expanded class hierarchy of FeedsHTTPFetcherResult
File
- plugins/
FeedsHTTPFetcher.inc, line 13
View source
class FeedsHTTPFetcherResult extends FeedsFetcherResult {
/**
* The URL of the feed being fetched.
*
* @var string
*/
protected $url;
/**
* The timeout in seconds to wait for a download.
*
* @var int
*/
protected $timeout;
/**
* Whether to ignore SSL validation errors.
*
* @var bool
*/
protected $acceptInvalidCert;
/**
* Whether to cache the HTTP result.
*
* @var bool
*/
protected $cacheHttpResult;
/**
* Constructor.
*/
public function __construct($url = NULL) {
$this->url = $url;
}
/**
* Overrides FeedsFetcherResult::getRaw().
*
* @throws FeedsHTTPRequestException
* In case the result code of the HTTP request is not in the 2xx series.
*/
public function getRaw() {
if ($this
->rawExists()) {
return parent::getRaw();
}
// Include HTTP functions.
feeds_include_library('http_request.inc', 'http_request');
// Try to fetch the data from a URL.
$result = feeds_http_request($this->url, array(
'accept_invalid_cert' => $this->acceptInvalidCert,
'timeout' => $this->timeout,
'cache_http_result' => $this->cacheHttpResult,
));
http_request_check_result($this->url, $result);
$this->raw = $result->data;
return $this
->sanitizeRawOptimized($this->raw);
}
/**
* Returns the configured value for the request timeout option.
*
* @return int
* Timeout in seconds to wait for an HTTP get request to finish.
*/
public function getTimeout() {
return $this->timeout;
}
/**
* Sets the request timeout option.
*
* @param int $timeout
* Timeout in seconds to wait for an HTTP get request to finish.
*/
public function setTimeout($timeout) {
$this->timeout = $timeout;
}
/**
* Sets the accept invalid certificates option.
*
* @param bool $accept_invalid_cert
* Whether to accept invalid certificates.
*/
public function setAcceptInvalidCert($accept_invalid_cert) {
$this->acceptInvalidCert = (bool) $accept_invalid_cert;
}
/**
* Sets the cache HTTP results of request option.
*
* @param bool $cache_http_result
* Whether to cache the HTTP result.
*/
public function setCacheHttpResult($cache_http_result) {
$this->cacheHttpResult = (bool) $cache_http_result;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FeedsFetcherResult:: |
protected | property | The path to a file where the raw data is stored. | |
FeedsFetcherResult:: |
protected | property | The raw fetched data. | |
FeedsFetcherResult:: |
protected | function | Checks that a file exists and is readable. | |
FeedsFetcherResult:: |
public | function | Constructs file name for saving the raw data. | |
FeedsFetcherResult:: |
public | function | Returns if the file to parse exists. | |
FeedsFetcherResult:: |
public | function | Returns directory for storing files that are in progress of import. | |
FeedsFetcherResult:: |
public | function | Returns the contents of a file, if it exists. | |
FeedsFetcherResult:: |
public | function | Get a path to a temporary file containing the resource provided by the fetcher. | 1 |
FeedsFetcherResult:: |
public | function | Returns if raw data exists. | |
FeedsFetcherResult:: |
public | function | Sanitize the file in place. | |
FeedsFetcherResult:: |
public | function | Sanitize the raw content string. | |
FeedsFetcherResult:: |
public | function | Sanitize the raw content string. | |
FeedsFetcherResult:: |
public | function | Saves the raw fetcher result to a file. | |
FeedsFetcherResult:: |
public | function | Prevent saving the raw result when serializing object. | |
FeedsHTTPFetcherResult:: |
protected | property | Whether to ignore SSL validation errors. | |
FeedsHTTPFetcherResult:: |
protected | property | Whether to cache the HTTP result. | |
FeedsHTTPFetcherResult:: |
protected | property | The timeout in seconds to wait for a download. | |
FeedsHTTPFetcherResult:: |
protected | property | The URL of the feed being fetched. | |
FeedsHTTPFetcherResult:: |
public | function |
Overrides FeedsFetcherResult::getRaw(). Overrides FeedsFetcherResult:: |
|
FeedsHTTPFetcherResult:: |
public | function | Returns the configured value for the request timeout option. | |
FeedsHTTPFetcherResult:: |
public | function | Sets the accept invalid certificates option. | |
FeedsHTTPFetcherResult:: |
public | function | Sets the cache HTTP results of request option. | |
FeedsHTTPFetcherResult:: |
public | function | Sets the request timeout option. | |
FeedsHTTPFetcherResult:: |
public | function |
Constructor. Overrides FeedsFetcherResult:: |