Changed checkRemoteFile function to be faster and smaller

This requires that links be public. Forum links appear not to work in testing.
This commit is contained in:
Arctic Code 2013-05-11 19:56:18 -05:00
parent b3d1dfc202
commit 33712de612

View File

@ -45,19 +45,10 @@ function prepOutputText($text) { // Takes mysql string and makes it able to be u
return $output; return $output;
} }
function checkRemoteFile($url) function checkRemoteFile($url){
{ if (@file_get_contents($url)): return true;
$ch = curl_init(); else: return false;
curl_setopt($ch, CURLOPT_URL,$url); endif;
// don't download content
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;
}
} }
if(isset($_GET['l'])) { // if there is a link... if(isset($_GET['l'])) { // if there is a link...