| Server IP : 202.61.199.114 / Your IP : 216.73.217.139 Web Server : nginx/1.22.1 System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web20 ( 1018) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/clients/client2/whatsapp-spy.de/web/ |
Upload File : |
<?php
header("Content-type: application/json");
//echo "test";
//die();
$apiKey = "e97fb124bb664cdf839c7d3947fd81d9";
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
$location = get_geolocation($apiKey, $ip, "ip", "country_code2,city,languages,isp,organization");
$decodedLocation = json_decode($location, true);
function get_geolocation($apiKey, $ip, $lang = "de", $fields = "*", $excludes = "") {
$url = "https://api.ipgeolocation.io/ipgeo?apiKey=".$apiKey."&ip=".$ip."&lang=".$lang."&fields=".$fields."&excludes=".$excludes;
$cURL = curl_init();
curl_setopt($cURL, CURLOPT_URL, $url);
curl_setopt($cURL, CURLOPT_HTTPGET, true);
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cURL, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Accept: application/json'
));
return curl_exec($cURL);
}
//header('Content-Type: text/csv');
//echo "<pre>"; print_r($decodedLocation); echo "</pre>";
echo json_encode( $decodedLocation );
die();
function jsonToCsv ($json, $csvFilePath = false, $boolOutputFile = false) {
// See if the string contains something
if (empty($json)) {
die("The JSON string is empty!");
}
// If passed a string, turn it into an array
if (is_array($json) === false) {
$json = json_decode($json, true);
unset($json[0]);
}
// If a path is included, open that file for handling. Otherwise, use a temp file (for echoing CSV string)
if ($csvFilePath !== false) {
$f = fopen($csvFilePath,'w+');
if ($f === false) {
die("Couldn't create the file to store the CSV, or the path is invalid. Make sure you're including the full path, INCLUDING the name of the output file (e.g. '../save/path/csvOutput.csv')");
}
}
else {
$boolEchoCsv = true;
if ($boolOutputFile === true) {
$boolEchoCsv = false;
}
$strTempFile = 'csvOutput' . date("U") . ".csv";
$f = fopen($strTempFile,"w+");
}
$firstLineKeys = false;
foreach ($json as $line) {
if (empty($firstLineKeys)) {
$firstLineKeys = array_keys($line);
fputcsv($f, $firstLineKeys);
$firstLineKeys = array_flip($firstLineKeys);
}
// Using array_merge is important to maintain the order of keys acording to the first element
fputcsv($f, array_merge($firstLineKeys, $line));
}
fclose($f);
// Take the file and put it to a string/file for output (if no save path was included in function arguments)
if ($boolOutputFile === true) {
if ($csvFilePath !== false) {
$file = $csvFilePath;
}
else {
$file = $strTempFile;
}
// Output the file to the browser (for open/save)
if (file_exists($file)) {
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Length: ' . filesize($file));
readfile($file);
}
}
elseif ($boolEchoCsv === true) {
//$iCount=0;
if (($handle = fopen($strTempFile, "r")) !== FALSE) {
while (($data = fgetcsv($handle)) !== FALSE) {
//if($iCount > 1) {
echo implode(";",$data);
echo "\n";
//}
//$iCount++;
}
fclose($handle);
}
}
// Delete the temp file
unlink($strTempFile);
}
?>