Based on IP address change the info of a site

Reply

Join Date: May 2008
Posts: 90
Reputation: Suhacini is an unknown quantity at this point 
Solved Threads: 0
Suhacini Suhacini is offline Offline
Junior Poster in Training

Based on IP address change the info of a site

 
0
  #1
May 12th, 2008
Hi,
Can I change the information of a site depending on ip address.

For example:
I have different folders for each geographic location, say for USA it should show a different site, for UK it should show a different site, like wise depending on the IP address it should go to that particular folder or index file.

Is tht possible using php?
Suhasini
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 31
Reputation: rgviza is an unknown quantity at this point 
Solved Threads: 5
rgviza rgviza is offline Offline
Light Poster

Re: Based on IP address change the info of a site

 
0
  #2
May 14th, 2008
Originally Posted by Suhacini View Post
Hi,
Can I change the information of a site depending on ip address.

For example:
I have different folders for each geographic location, say for USA it should show a different site, for UK it should show a different site, like wise depending on the IP address it should go to that particular folder or index file.

Is tht possible using php?
There are two ways of doing this. One is to buy the MaxMind database, another is to do whois calls using a socket (not through their web interface!) and cache the netblock results so you don't hammer whois and get yourself banned.

-r
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 90
Reputation: Suhacini is an unknown quantity at this point 
Solved Threads: 0
Suhacini Suhacini is offline Offline
Junior Poster in Training

Re: Based on IP address change the info of a site

 
0
  #3
May 14th, 2008
Can you tell me how can I use whois? If I use that will it be possible something like this : If user is from US he shuold see one page, If he is from UK then he must see different page...and so on different places differen pages...
Suhasini
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 31
Reputation: rgviza is an unknown quantity at this point 
Solved Threads: 5
rgviza rgviza is offline Offline
Light Poster

Re: Based on IP address change the info of a site

 
0
  #4
May 14th, 2008
you can parse country information from whois response. the various ip authorities have different record formats so you have some work ahead of you.

ARIN will tell you if you need to go to another authority. Look for the Referral Server field. The presence of this field indicates that the record is delegated.

Also look for and follow referral records to the final netblock record. if you get a record with nothing but netblocks, the smallest netblock is the one you need to search for the whois record on to get the information. These referral records are created by ISP's who sublet chunks of their IP allocation.

If you aren't familiar with text parsing and especially IP address calculations, working with whois, and need to do this in a hurry, I'd buy the database. It's a *lot* easier. They have a trial database so you can demo it. Just make sure you use IP's in the trial database for demo.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC