Hi, Sunday, October 12, 2003, 4:53:27 PM, you wrote: JF> On Sunday, October 12, 2003, at 12:02 PM, Manuel Vázquez Acosta wrote:
>> Take a look at what is printed by: >> >> var_dump($_SERVER); >> >> Maybe the HTTP_USER_AGENT can lead you to somewhere out of this >> problem. >> >> Manu. >> >> "Shaun" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >>> Hi, >>> >>> I have created an online system, and have created a WAP version, and >>> am >>> currently crreating a PDA version. What I wuold like to to do is give >>> out >>> the same URL instead of domain.com for normal use, domain.com/wap/ or >>> domain.com/pda/. Is there a way of detecting what device is loading >>> the >> site >>> and redirect them accordingly? >>> >>> Thanks for your help JF> Manuel, Shaun, JF> $_SERVER['HTTP_USER_AGENT'] (just like anything else from the client JF> side) can't be trusted to either exist, or to be correct. Some user JF> agents don't set this value, and it's quite easy for it to be faked. JF> More to the point, there's no way you can possibly account for all JF> possible user agents out there... perhaps only the popular ones. JF> So, $_SERVER['HTTP_USER_AGENT'] is a good starting point or method for JF> guessing where to send people, but it's not fail safe AT ALL. JF> I think the fail safe way is to create pages which are standards JF> compliant (XHTML strict) and use CSS for all styling/presentation, JF> which means your pages will accessible via the largest possible number JF> of viewing devices, like PDA, WAP, text-to-speech, desktop browsers, JF> Web TV, etc. JF> The move away from table based layouts and poorly accessible webpages JF> is a big one, but not THAT big :) JF> Justin JF> -- JF> PHP General Mailing List (http://www.php.net/) JF> To unsubscribe, visit: http://www.php.net/unsub.php From my experience css is even more unreliable than user agent being set and all browser producers seem to have their own idea of what a standard is supposed to look like as well. At least with table layouts most of the current desktop browsers will make a half decent try. With companies like Netscape and Microsoft providing browsers you should stay away from strict anything is my advice :) The ideal way of detecting a wap browser is through the accepted mime types from the request header but I am not sure if that info is passed on by PHP. You could try <? $headers = apache_request_headers(); print_r($headers); <? and see what is supplied under accept with various devices You need to look for something like this: text/vnd.wap.wml for .wml files (WML source files) application/vnd.wap.wmlc for .wmlc files (WML compiled files) text/vnd.wap.wmlscript for .wmls files (WMLScript source files) application/vnd.wap.wmlscriptc for .wmlsc files (WMLScript compiled files) image/vnd.wap.wbmp for .wbmp files (wireless bitmaps) -- regards, Tom