Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Automatically redirect to Google Translator when certain domain TLD used
Closed Thread
Old 08-11-2009, 10:22 PM   #1 (permalink)
 
Super Techie

Join Date: Oct 2004

Posts: 384

Mr. tech is on a distinguished road

Default Automatically redirect to Google Translator when certain domain TLD used

I have set-up Google Translation on a clients website. He currently owns the .net for his domain and also wants to buy other country TLDs such as .de, .cn etc etc He wants it so that when you load the website using another countries TLD, it will redirect and translate the page.

I've got a PHP function that works except it redirects over and over because even though Google loads the website in a framed page, it doesn't give any $_GET or $_POST variables so I can determine whether it has already been redirected or not. Am I making sense? My code below?

PHP Code:
function curPageURL() {
    
$pageURL 'http';
    if (
$_SERVER["HTTPS"] == "on")
        
$pageURL .= "s";
    
$pageURL .= "://";
    if (
$_SERVER["SERVER_PORT"] != "80")
        
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
    else
        
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
    return 
$pageURL;
}
if (
preg_match('|\.de|'$_SERVER["SERVER_NAME"], $match)) {
    
header('location: http://translate.google.com/translate?u=' urlencode(curPageURL()) . '&hl=en&langpair=auto|de&tbb=1&ie=UTF-8');

Or is there a PHP function that allows you to detect the content language so I can check to see if it is no longer english and has been translated? Any input would be fantastic!

I hope this message makes sense...
Mr. tech is offline  
Old 08-13-2009, 06:49 PM   #2 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default Re: Automatically redirect to Google Translator when certain domain TLD used

it looks like you're sending them to Google Translate. can you check for this and decide not to redirect if found?
office politics is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please analyze my logs myr707 HijackThis Logs (finished) 6 06-23-2009 12:29 AM
Your Google Docs May Be Open to Hijacking Mak213 News & Polls 0 12-30-2008 03:41 PM
Google Chrome Anonymizer Osiris Browser & General Internet Questions 0 09-07-2008 10:19 PM
Try out my new script programm! mssssee2 Windows Operating Systems and Software 11 07-20-2007 11:52 AM