From 33712de612abd5d82fbd20b5d3726acc821a9f99 Mon Sep 17 00:00:00 2001 From: Arctic Code Date: Sat, 11 May 2013 19:56:18 -0500 Subject: [PATCH] Changed checkRemoteFile function to be faster and smaller This requires that links be public. Forum links appear not to work in testing. --- short/index.php | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/short/index.php b/short/index.php index d0cf7c6..d6ee241 100755 --- a/short/index.php +++ b/short/index.php @@ -45,19 +45,10 @@ function prepOutputText($text) { // Takes mysql string and makes it able to be u return $output; } -function checkRemoteFile($url) -{ - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL,$url); - // 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; - } +function checkRemoteFile($url){ + if (@file_get_contents($url)): return true; + else: return false; + endif; } if(isset($_GET['l'])) { // if there is a link...