Fix type-safety issues around curl in new checking HTTP status function
This commit is contained in:
parent
88458df949
commit
b143845aea
|
@ -428,11 +428,14 @@ final class MD_STD {
|
||||||
*/
|
*/
|
||||||
public static function checkUrlIsReachable(string $url):bool {
|
public static function checkUrlIsReachable(string $url):bool {
|
||||||
|
|
||||||
|
if (empty($url)) {
|
||||||
|
throw new MDInvalidUrl("Input URL cannot be empty");
|
||||||
|
}
|
||||||
if (filter_var($url, FILTER_VALIDATE_URL) === false) {
|
if (filter_var($url, FILTER_VALIDATE_URL) === false) {
|
||||||
throw new MDInvalidUrl("URL to check (" . $url . ") does not seem to be a valid URL");
|
throw new MDInvalidUrl("URL to check (" . $url . ") does not seem to be a valid URL");
|
||||||
}
|
}
|
||||||
|
|
||||||
$ch = curl_init($url);
|
$ch = self::curl_init($url, 5000);
|
||||||
curl_setopt_array($ch, [
|
curl_setopt_array($ch, [
|
||||||
CURLOPT_AUTOREFERER => true,
|
CURLOPT_AUTOREFERER => true,
|
||||||
CURLOPT_CONNECTTIMEOUT => 5,
|
CURLOPT_CONNECTTIMEOUT => 5,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user