Created
November 27, 2017 09:54
-
-
Save stevetrask/d9b374df4448509f5f2718be46c6c2c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function checkRemoteFile($url) | |
{ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL,$url); | |
curl_setopt($ch, CURLOPT_NOBODY, 1); | |
curl_setopt($ch, CURLOPT_FAILONERROR, 1); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
if(curl_exec($ch)!==FALSE) | |
{ | |
return true; | |
} | |
else | |
{ | |
return false; | |
} | |
} | |
$url = 'https://s3.eu-west-2.amazonaws.com/test.pdf'; | |
$check = checkRemoteFile($url); | |
if(true == $check){ | |
echo "ok"; | |
}else{ | |
echo "not ok"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment