Changeset 591 for trunk/lib


Ignore:
Timestamp:
Mar 19, 2017 1:36:34 PM (7 years ago)
Author:
anonymous
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Utilities.inc.php

    r590 r591  
    14121412
    14131413/*
    1414 * Returns true if the given URL resolves to a resource with a HTTP 200 header response.
     1414* Returns true if the given URL resolves to a resource with a HTTP 2xx or 3xx header response.
    14151415*
    14161416* @access   public
     
    14241424{
    14251425    $ch = curl_init($url);
    1426     curl_setopt($ch, CURLOPT_TIMEOUT, 2);
     1426    curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    14271427    curl_setopt($ch, CURLOPT_NOBODY, true);
    14281428    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    14291429    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    14301430    curl_exec($ch);
    1431     return '200' == curl_getinfo($ch, CURLINFO_HTTP_CODE);
    1432 }
     1431    $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
     1432    return preg_match('/^[23]\d\d$/', $http_code);
     1433}
Note: See TracChangeset for help on using the changeset viewer.