diff --git a/api/api.backend.php b/api/api.backend.php index 968f474..3bea16e 100644 --- a/api/api.backend.php +++ b/api/api.backend.php @@ -9,10 +9,31 @@ * ============================================================ */ -function checkRemoteFile($link){ - if (@file_get_contents($link)): return true; - else: return false; - endif; +function checkRemoteFile($ip=null){ + if($ip==null) return false; + + // Setup the connection and only get the headers + $header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,"; + $header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"; + $header[] = "Cache-Control: max-age=0"; + $header[] = "Connection: keep-alive"; + $header[] = "Keep-Alive: 300"; + $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7"; + $header[] = "Accept-Language: en-us,en;q=0.5"; + $header[] = "Pragma: "; + + $curlInit = curl_init($ip); + curl_setopt($curlInit, CURLOPT_CONNECTTIMEOUT, 10); + curl_setopt($curlInit, CURLOPT_HEADER, true); + curl_setopt($curlInit, CURLOPT_RETURNTRANSFER, true); + curl_setopt($curlInit, CURLOPT_USERAGENT, 'UnPS-GAMATechnologies (UnPS WebQuery/4-2.8; +http://unps.us)'); + curl_setopt($curlInit, CURLOPT_HTTPHEADER, $header); + + $response = curl_exec($curlInit); + curl_close($curlInit); + + if($response) return true; + return false; } include('hashpass.php');