Backend Development

PHP IP + Country (No API)

Submitted by tnxbt, , Thread ID: 51953

Thread Closed

RE: PHP IP + Country (No API)

dupi
Newbie
Level:
0
Reputation:
0
Posts:
13
Likes:
1
Credits:
9
20-10-2017, 03:01 PM
This post was last modified: 20-10-2017, 03:01 PM by dupi
#2
19-10-2017, 01:40 PM
tnxbt Wrote:
This is not my code, but I want to share it as it doesn't requireyou to use an API. I put the three phpfiles in a zip, you can include it on any page easily. Include geo.ip to any pageand edit that file.

Example :https://societyvpn.com/geo.php

It doesn't need hiding, its a public code anyway.

https://a.bakka.me/inxndrx.zip

Thanks to cumslutfor the file host.

PHP Code:
header('Content-Type: text/html; charset=Latin5');
function 
getLocation($ipadresi)
{
$ch curl_init();
curl_setopt($ch,CURLOPT_URL,"http://www.ipsorgu.com/ip_numarasindan_adres_bulma.php?ip=".$ipadresi."#sorgu");
curl_setopt($chCURLOPT_RETURNTRANSFER,1);
$cikti curl_exec($ch);
$baslangic strpos($cikti,'.png" alt="')+strlen('.png" alt="');
$duzenle substr($cikti,$baslangic);
$bitis strpos($duzenle,'">');
$geriDonen substr($duzenle,0,$bitis);
curl_close($ch);
return 
$geriDonen;
}

echo 
getLocation("5.176.204.175"); 

Users browsing this thread: 1 Guest(s)