Метод | Описание | |
---|---|---|
__construct ( array $config = [], |
||
fetchContent ( string $url ) : array | Fetch content from the given url and return a readable content. | |
getConfig ( string $key ) : mixed | Return a config. | |
setLogger ( Psr\Log\LoggerInterface $logger ) | Redefine all loggers. |
Метод | Описание | |
---|---|---|
convert2Utf8 ( string $html, string $header = null ) : string | Convert string to utf8 (uses HTTP headers and HTML to find encoding). | |
doFetchContent ( string $url ) : array | Do fetch content from an url. | |
extractOpenGraph ( string $html, string $baseUrl ) : array | Extract OpenGraph data from the response. | |
getExcerpt ( string $text, integer $length = 250, string $separator = ' …' ) : string | Truncate text. | |
getMimeActionInfo ( string $headers ) : array | Based on content-type http header, decide what to do. | |
getSinglePage ( string $html, string $url ) : false | array | returns single page response, or false if not found. | |
handleMimeAction ( array $mimeInfo, string $effectiveUrl, string $body = '' ) : array | null | Handle action related to mime type detection. | |
isUrlAllowed ( $url ) | ||
makeAbsolute ( string $base, DOMNode $elem ) | Make an absolute url from an element. | |
makeAbsoluteAttr ( string $base, DOMNode $e, string $attr ) | Make an attribute absolute (href or src). | |
makeAbsoluteStr ( string $base, string $url ) : false | string | Make an $url absolute based on the $base. | |
unparse_url ( array $data ) : array | Rebuild an url using the response from parse_url. | |
validateUrl ( string $url ) : string | Validate & clean the given url. |
public __construct ( array $config = [], |
||
$config | array | |
$client | Guzzle client | |
$configBuilder |
public fetchContent ( string $url ) : array | ||
$url | string | |
Результат | array | With keys html, title, url & summary |
public setLogger ( Psr\Log\LoggerInterface $logger ) | ||
$logger | Psr\Log\LoggerInterface |