Backend Development

PHP IP + Country (No API)

Submitted by tnxbt, , Thread ID: 51953

Thread Closed
19-10-2017, 01:40 PM
#1
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.
A-N

RE: PHP IP + Country (No API)

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"); 

RE: PHP IP + Country (No API)

OP
#3

What you posted is a bad way to do it, as it requires another site to do the work making loading times slower overall.
A-N

RE: PHP IP + Country (No API)

This post was last modified: 20-10-2017, 03:27 PM by dupi
#4
Do you have a geo ip database?
you do not have to use this system if you have it but you have to use other sites

Edit :
I sent this code because the script you gave it may lose its update over time

RE: PHP IP + Country (No API)

#5
Is everything required in the .zip file? Battling to get this to work

RE: PHP IP + Country (No API)

OP
#6
21-10-2017, 10:47 PM
IWantStuff Wrote:
Is everything required in the .zip file? Battling to get this to work

Yes, whats the problem you are facing?
A-N

RE: PHP IP + Country (No API)

#7
22-10-2017, 12:24 PM
tnxbt Wrote:
Yes, whats the problem you are facing?

I'm not 100% sure. The error log isn't displaying anything

RE: PHP IP + Country (No API)

OP
#8
22-10-2017, 12:39 PM
IWantStuff Wrote:
I'm not 100% sure. The error log isn't displaying anything

Does nothing show up on the page at all or are you getting HTTP error?
A-N

RE: PHP IP + Country (No API)

#9
22-10-2017, 01:09 PM
tnxbt Wrote:
Does nothing show up on the page at all or are you getting HTTP error?

Nothing's showing up at all

RE: PHP IP + Country (No API)

OP
#10
22-10-2017, 02:47 PM
IWantStuff Wrote:
Nothing's showing up at all

Is it locally you are trying to do this or on server? It doesn't work locally.
A-N

Users browsing this thread: 4 Guest(s)