X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FParseUrl.php;h=79f427a654df4b5f672bc52f3470ebe01deb2b5b;hb=0a45bdd3b71ec0f8744abb3830858a91a4bca146;hp=f1e96dedc3b8347a0c673f5134c285b0c2f2203e;hpb=7e618856ab09ac74a3760e238c73ecb9515f6701;p=friendica.git diff --git a/src/Util/ParseUrl.php b/src/Util/ParseUrl.php index f1e96dedc3..79f427a654 100644 --- a/src/Util/ParseUrl.php +++ b/src/Util/ParseUrl.php @@ -70,7 +70,12 @@ class ParseUrl $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])) { @@ -91,7 +96,7 @@ class ParseUrl } /** - * 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() @@ -686,7 +691,7 @@ class ParseUrl { $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;