PHP-Grab-Favicon
PHP-Grab-Favicon copied to clipboard
cURL Timeout Not Working Properly
There is a bug (my fault) where the curl timeout isn't being set properly, this will cause it to hang instead of timing out.
I have fixed it locally but I've changed other things as well and not ready for a PR.
Quick fix is to insert the following two lines in the load
function
$timeOut = getGlobal('curl_timeout');
if (!isset($timeOut )) { $timeOut = 60; }
Current:
function load($url, $DEBUG, $consoleMode = false, $timeOut = 60) {
if (function_exists('curl_version')) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERAGENT, getGlobal('curl_useragent'));
curl_setopt($ch, CURLOPT_VERBOSE, getGlobal('curl_verbose'));
curl_setopt($ch, CURLOPT_TIMEOUT, $timeOut);
** Hot Fix:**
function load($url, $DEBUG, $consoleMode = false, $timeOut = 60) {
if (function_exists('curl_version')) {
$timeOut = getGlobal('curl_timeout');
if (!isset($timeOut )) { $timeOut = 60; }
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERAGENT, getGlobal('curl_useragent'));
curl_setopt($ch, CURLOPT_VERBOSE, getGlobal('curl_verbose'));
curl_setopt($ch, CURLOPT_TIMEOUT, $timeOut);
(It's handled much better in the newer code)