$options = [];
}
- $curlResult = DI::httpClient()->head($url, array_merge([HttpClientOptions::ACCEPT_CONTENT => $accept], $options));
+ try {
+ $curlResult = DI::httpClient()->head($url, array_merge([HttpClientOptions::ACCEPT_CONTENT => $accept], $options));
+ } catch (\Exception $e) {
+ DI::logger()->debug('Got exception', ['url' => $url, 'message' => $e->getMessage()]);
+ return [];
+ }
// Workaround for systems that can't handle a HEAD request. Don't retry on timeouts.
if (!$curlResult->isSuccess() && ($curlResult->getReturnCode() >= 400) && !in_array($curlResult->getReturnCode(), [408, 504])) {
}
/**
- * Search for chached embeddable data of an url otherwise fetch it
+ * Search for cached embeddable data of an url otherwise fetch it
*
* @param string $url The url of the page which should be scraped
* @param bool $do_oembed The false option is used by the function fetch_oembed()
$arr_tags = str_getcsv($string);
if (count($arr_tags)) {
// add the # sign to every tag
- array_walk($arr_tags, ['self', 'arrAddHashes']);
+ array_walk($arr_tags, [self::class, 'arrAddHashes']);
return $arr_tags;
}
{
$urlarr = parse_url($url);
- // If the url does allready have an scheme
+ // If the url does already have an scheme
// we can stop the process here
if (isset($urlarr['scheme'])) {
return $url;