diff --git a/index.php b/index.php index d283e3f..6c254f2 100644 --- a/index.php +++ b/index.php @@ -165,15 +165,20 @@ if ($errors=='' && $_GET['acctock']!='' && $_GET['host']!='') { } $acchostck=htmlentities($acchostck); $http_response_header=null; + $httpcode=null; $url=$_GET['host'].'/api/v1/accounts/lookup?acct='.urlencode($_GET['acctock']); $hacctock=htmlentities($_GET['acctock']); $hurl=htmlentities($url); $res=@file_get_contents('https://'.$url,false,$context); //echo preprint($http_response_header); - if (isset($http_response_header)) + if (isset($http_response_header)) { + $httpcode=gethttpcode($http_response_header); $rl=ckratelimit($http_response_header,'echofun',true,false); + } if ($res===false) { echo "
Error: could not connect to «{$hhost}».
\n"; + } elseif (isset($httpcode) && $httpcode!='200') { + echo "
Error: «{$hurl}» returned an HTTP code that is different than «200»: {$httpcode}.
\n"; } elseif (null===$res=@json_decode($res,true)) { echo "
Error: «{$hurl}» returned data that could not be parsed as JSON (".json_last_error().': '.json_last_error_msg().").
\n"; } elseif (isset($res['error'])) {