PHP redirect

Not open for further replies.
Hi, I am adding a HTML/CSS version to a flash website. I didn't design the website -

I want to change the following PHP code so that if the browser is an iPod or iPad that it will go to my CSS/HTML version of the website -

Here's the code. Does anyone know how to change this to do what is needed, please.


// Include application details




// Create crawler object

$crawler = new WebCrawler("homepage");

// If crawler, get contents to display

if($crawler->isCrawler) {


$crawler->addField("Title", "/", "title");

$crawler->addField("Content", "/", "", "html");


else {


Only show enter page if flash isn't installed

// Set cookie to skip intro (keep cookie for 2 weeks)


// Set cookie each time

Cookies::set("skip_enter_page", 1, 14);



// Display flash or crawler html (requiredFlashVersion)


Well, that's really not enough... what is include("_classes/Application.php"); ? You don't need to paste the content here if it's some open source class that can be downloaded from the web, but we need more details to be able to help you out.

The only way to redirect the page for mobiles using only PHP is if that flash sets a cookie when it starts. Thus, the iPod or iPad won't set the cookie as they can't run flash, at least that's what I can make out of your code. Yes, there are other PHP only options, but still, I would reconsider using this one.

If you want to stick to PHP, I'm guessing $_SERVER['HTTP_USER_AGENT'] should be enough to check if you're dealing with a mobile or not. Look into that. Unfortunatelly I don't own an iPad or iPod myself so can't help you out here.

P.S: Can an iPod open websites? What about the iPhone?
Not open for further replies.
Award-winning Mac antivirus and Internet security software