X-Git-Url: https://git.ao2.it/tweeper.git/blobdiff_plain/01dfd03d97afd0d5d06a36af37d96892905340ad..5333d3c8ec110a4349dfc3b56168a157afc70082:/src/Tweeper.php diff --git a/src/Tweeper.php b/src/Tweeper.php index cfa3812..22d16ab 100644 --- a/src/Tweeper.php +++ b/src/Tweeper.php @@ -124,7 +124,14 @@ class Tweeper { CURLOPT_SSL_VERIFYPEER => FALSE, CURLOPT_USERAGENT => Tweeper::$userAgent, )); - curl_exec($ch); + + $ret = curl_exec($ch); + if (FALSE === $ret) { + trigger_error(curl_error($ch)); + curl_close($ch); + return FALSE; + } + $url_info = curl_getinfo($ch); if (FALSE === $url_info) { trigger_error(curl_error($ch)); @@ -160,6 +167,10 @@ class Tweeper { ); $url_info = Tweeper::getUrlInfo($url); + if (FALSE === $url_info) { + error_log("Failed to retrieve info for URL: " . $url); + return ''; + } $supported = in_array($url_info['content_type'], $supported_content_types); if (!$supported) { @@ -320,6 +331,9 @@ class Tweeper { } $stylesheet_contents = Tweeper::getUrlContents($stylesheet); + if (FALSE === $stylesheet_contents) { + return NULL; + } $xslDoc = new DOMDocument(); $xslDoc->loadXML($stylesheet_contents);