Top 10 Apps

  1. Softick Coloring Book
  2. Softick Solitaire
  3. PLIBA - Search & Book Anything
  4. My Pocket Mistress (All 21 Videos)
  5. MSN Messenger
  6. Number Invasion
  7. Columns
  8. Matchbooks
  9. Othelli
  10. SundayMorningRides.com Mobile

Latest Apps

  1. BnkRoll
  2. Just.mobi
  3. iStatcounter
  4. Wallpapr for iPhone
  5. Obama iFan
  6. Tag It Like It's Hot
  7. ZWave Commander
  8. EyeKiwi
  9. iYoReMo
  10. gulp!

Archives



iPhone Topsites
iPhoneTopsite.com
iPhone Topsites


PHP Auto-bowser Detection

This is very simple, even for people who don't know PHP. Our site uses this script to auto-redirect iPhone users to our specially designed iPhone page. Here is our PHP:

<?php
$browser = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone"); if ($browser === true) { { echo 'Code You Want To Execute'; }
?>

So lets disect this,

$browser = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone")

"$_SERVER['HTTP_USER_AGENT']" is a function built into PHP, to get various amounts of information from the users browser. You can read more about this function here.

Next, using another built in function of PHP stripos, we can search for a string inside our $browser. If stripos finds "iPhone" in $browser, it will let us run the code in side the if statement

if ($browser === true) { { echo 'Code You Want To Execute'; }

So what can you put in the if statement?, you can put a redirect, a different stylesheet link or just post a special message to iPhone users. I hope this basic tutorial helps you with your iPhone Application!
Download This Script