<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Fri, 24 May 2013 12:08:18 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Sameer Borate's Blog: Detecting user agents in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/13348</guid>
      <link>http://www.phpdeveloper.org/news/13348</link>
      <description><![CDATA[<p>
In <a href="http://www.codediesel.com/pear/detecting-user-agents-in-php/">a new post</a> to his blog today <i>Sameer</i> looks at a trick or two about detecting the type of browser/client a visitor is using to view your website - one method with the superglobal and another with a helpful PEAR package.
</p>
<blockquote>
Every time you use your browser to access a website a User-Agent header is sent to the respective server. Detecting user agents on the server can be useful for many reasons: browser quirks, personalize content, preventing illegal access. 
</blockquote>
<p>
He talks about the <a href="http://us2.php.net/manual/en/function.get-browser.php">get_browser</a> function that's included in PHP but that requires a browscap.ini file to work. His other option is the <a href="http://pear.php.net/package/net_useragent_detect/redirected">Net_UserAgent_Detect</a> PEAR package. It grabs the user agent and breaks it up into the browser type, operating system information and any Javascript-related headers that come along with it. There's also useful tests like "isIE()" and "isNetscape()" built into the package.
</p>]]></description>
      <pubDate>Wed, 07 Oct 2009 08:21:22 -0500</pubDate>
    </item>
  </channel>
</rss>
