countrycode . ", " . $resp->regionname . ", " . $resp->city . ", (" . $resp->latitude . ", " . $resp->longitude . ")]"); $d = file_get_contents("http://api.ipinfodb.com/v2/ip_query.php?ip=$ip&output=xml&key=31abd9237986208b6760618d43c04857944096046a368c2e5e322b5f4566e004"); //Use backup server if cannot make a connection if (!$d){ $backup = file_get_contents("http://api.ipinfodb.com/v2/ip_query.php?ip=$ip&output=xml&key=31abd9237986208b6760618d43c04857944096046a368c2e5e322b5f4566e004"); $resp = new SimpleXMLElement($backup); if (!$backup) return false; // Failed to open connection }else{ $resp = new SimpleXMLElement($d); } fwrite($fh, " [" . $resp->CountryCode . ", " . $resp->RegionName . ", " . $resp->City . ", (" . $resp->Latitude . ", " . $resp->Longitude . ")]"); fwrite($fh, " at: ". $now); fwrite($fh, "\n"); fclose($fh); //header('Content-type: application/pdf'); //header('Location: athanasoulis_cv.pdf'); header('Content-type: application/pdf'); // It will be called downloaded.pdf header('Content-Disposition: attachment; filename='.$DldFile); // The PDF source is in original.pdf readfile($DldFile); ?>