Backend Development

PHP IP + Country (No API)

Submitted by tnxbt, , Thread ID: 51953

Thread Closed
tnxbt
Member
Level:
0
Reputation:
10
Posts:
118
Likes:
10
Credits:
56
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)

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

RE: PHP IP + Country (No API)

tnxbt
Member
Level:
0
Reputation:
10
Posts:
118
Likes:
10
Credits:
56
OP
20-10-2017, 03:07 PM
#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)

dupi
Newbie
Level:
0
Reputation:
0
Posts:
13
Likes:
1
Credits:
9
20-10-2017, 03:24 PM
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)

IWantStuff
Closed Account
Level:
0
Reputation:
0
Posts:
23
Likes:
0
Credits:
2
21-10-2017, 10:47 PM
#5
Is everything required in the .zip file? Battling to get this to work

RE: PHP IP + Country (No API)

tnxbt
Member
Level:
0
Reputation:
10
Posts:
118
Likes:
10
Credits:
56
OP
22-10-2017, 12:24 PM
#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)

IWantStuff
Closed Account
Level:
0
Reputation:
0
Posts:
23
Likes:
0
Credits:
2
22-10-2017, 12:39 PM
#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)

tnxbt
Member
Level:
0
Reputation:
10
Posts:
118
Likes:
10
Credits:
56
OP
22-10-2017, 01:09 PM
#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)

IWantStuff
Closed Account
Level:
0
Reputation:
0
Posts:
23
Likes:
0
Credits:
2
22-10-2017, 02:47 PM
#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)

tnxbt
Member
Level:
0
Reputation:
10
Posts:
118
Likes:
10
Credits:
56
OP
22-10-2017, 04:52 PM
#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: 1 Guest(s)