Access Forbidden\n

but SARBL whois-get-proxy seems to be working fine !

"; exit(); } // allowed commands below header("Content-Type: text/plain"); switch ($_POST["command"]) { case "version": // return a version number for this script echo SARBL_WHOIS_VERSION; exit(); case "whois": // return the whois information of a domain using a specific whois server, max 1MB whois($_POST["domain"],$_POST["server"]); exit(); case "get": // return an HTTP url content, just a simple GET, max size being 1MB get($_POST["url"]); exit(); } echo "Command not found\n"; exit(); /** * Launch a whois request for domain $dom on server $srv * uses fsockopen, limit to 1MB returned text * timeout at 3 seconds for both connect and gets * echoes one line with a number if something went wrong */ function whois($dom,$srv) { $srv=str_replace("/","",$srv); $f=fsockopen($srv,43,$errno,$errstr,3); if (!$f) { echo "1"; return; } fputs($f,$dom."\r\n"); stream_set_timeout($f, 3); $s=""; while (!feof($f)) { $t=fgets($f,65536); $s.=$t; if (strlen($s)>=1024*1024) { // 1MB limit echo $s; fclose($f); return; } $info = stream_get_meta_data($f); if ($info['timed_out']) { echo $s; fclose($f); return; } } fclose($f); if (strlen($s)==0) { echo "2"; return; } echo $s; return; } /** * get $url URL using HTTP or HTTPS (only) via cURL * uses CURL, fails if it's not installed * echoes a number only if an error occurred */ function get($url) { $useragent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, $useragent); curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_jar); // curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_jar); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // curl_setopt($ch, CURLOPT_POST, true); // curl_setopt($ch, CURLOPT_POSTFIELDS, $POST); curl_setopt($ch, CURLOPT_HEADER, true); $return = curl_exec($ch); if (curl_errno($ch)) { echo "0\n"; echo curl_error($ch)."\n"; return; } curl_close($ch); echo $return; return; }