Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Geo/IP redirect 1

Status
Not open for further replies.

biobrain

MIS
Jun 21, 2007
90
GB
How I can write a geo/ip redirect php script? can any body hel me in this regards
 
Do you want to pick up the IP and if it's located , say in england you want to redirect to site.co.uk, or if it's in Japan site.co.jp ??
If so do a google for the base data (the php site used to have a link to the service they use)
looks interesting.
It's then just a matter of gettingthe data into a database, pick up the IP address and do a look up, then accroding to whatthe data says issue a header(location: and off you go.
 
Yes

I want to show different sites to people coming from different IP locations.

i.e different site/contents for users coming from Pakistan, UK, USA and Germany etc.

Regards
 
You would open a text editor (or whatever php writing tool you use) and write the script.

Or did you mistake these "Intelligent Work Forums for Computer Professionals" with "A place where somebody will write the code for me for free"?

___________________________________________________________
[small]Do something about world cancer today: Comprehensive cancer control information at PACT[/small]
 
Vragabond said:
Or did you mistake these "Intelligent Work Forums for Computer Professionals" with "A place where somebody will write the code for me for free"?

hear hear!


 
Dear All,

I am not saying any body to write the full script for me. Well I know that I can use notepad, kwrite, vi, etc for writing a php script.

I just want a start how to use IP redirection in PHP. I am new to PHP .

Otherwise please tell me some books/chapter to read for this.

Regards
 
Let me point you to the php online manual entry for header(Location):
This will redirect the browser to which ever URL you pass it.

And the $_SERVER superglobal from which you can extract the IP address of the user browsing the page.


That should at least give you a start.


----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top