cvs: /phpdoc/chapters config.sgml /phpdoc/functions misc.sgml
| From: | Torben Wilson | Date: | Tue, 21 Sep 1999 21:45:16 +0000 |
| Subject: | cvs: /phpdoc/chapters config.sgml /phpdoc/functions misc.sgml | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-11169@lists.php.net to get a copy of this message | ||
cslawi Tue Sep 21 17:45:16 1999 EDT
Modified files:
/phpdoc/chapters config.sgml
/phpdoc/functions misc.sgml
Log:
Documented get_browser().
Index: phpdoc/chapters/config.sgml
diff -u phpdoc/chapters/config.sgml:1.6 phpdoc/chapters/config.sgml:1.7
--- phpdoc/chapters/config.sgml:1.6 Tue Sep 21 04:50:57 1999
+++ phpdoc/chapters/config.sgml Tue Sep 21 17:45:16 1999
@@ -1247,7 +1247,8 @@
</term>
<listitem>
<para>
- Name of browser capabilities file.
+ Name of browser capabilities file. See also
+ <function>get_browser</function>.
</para>
</listitem>
</varlistentry>
Index: phpdoc/functions/misc.sgml
diff -u phpdoc/functions/misc.sgml:1.7 phpdoc/functions/misc.sgml:1.8
--- phpdoc/functions/misc.sgml:1.7 Tue Sep 21 06:37:22 1999
+++ phpdoc/functions/misc.sgml Tue Sep 21 17:45:16 1999
@@ -286,6 +286,119 @@
</refsect1>
</refentry>
+
+ <refentry id="function.get-browser">
+ <refnamediv>
+ <refname>get_browser</refname>
+ <refpurpose>Tells what the user's browser is capable of.</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Description</title>
+ <funcsynopsis>
+ <funcdef>object <function>get_browser</function></funcdef>
+ <paramdef>string
<parameter><optional>user_agent</optional></parameter></paramdef>
+ </funcsynopsis>
+
+ <simpara>
+ <function>get_browser</function> attempts to determine the
+ capabilities of the user's browser. This is done by looking up
+ the browser's information in the
+ <filename>browscap.ini</filename> file. By default, the value of
+ <variable>$HTTP_USER_AGENT</variable> is used; however, you can
+ alter this (i.e., look up another browser's info) by passing the
+ optional <parameter>user_agent</parameter> parameter to
+ <function>get_browser</function>.
+ </simpara>
+
+ <simpara>
+ The information is returned in an object, which will contain
+ various data elements representing, for instance, the browser's
+ major and minor version numbers and ID string;
+ true/false values for features such as frames, JavaScript, and
+ cookies; and so forth.
+ </simpara>
+
+ <simpara>
+ While <filename>browscap.ini</filename> contains information on
+ many browsers, it relies on user updates to keep the database
+ current. The format of the file is fairly self-explanatory.
+ </simpara>
+
+ <para>
+ The following example shows how one might list all available
+ information retrieved about the user's browser.
+
+ <example>
+ <title><function>get_browser</function> example</title>
+ <programlisting>
+<?php
+function list_array( $array ) {
+ while ( list( $key, $value ) = each( $array ) ) {
+ $str .= "<b>$key:</b> $value<br>\n";
+ }
+ return $str;
+}
+echo "$HTTP_USER_AGENT<hr>\n";
+$browser = get_browser();
+echo list_array( (array) $browser );
+?>
+ </programlisting>
+ </example>
+ </para>
+
+ <simpara>
+ The output of the above script would look something like this:
+ </simpara>
+
+ <simpara>
+ <programlisting>
+Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586)<hr>
+<b>browser_name_pattern:</b> Mozilla/4\.5.*<br>
+<b>parent:</b> Netscape 4.0<br>
+<b>platform:</b> Unknown<br>
+<b>majorver:</b> 4<br>
+<b>minorver:</b> 5<br>
+<b>browser:</b> Netscape<br>
+<b>version:</b> 4<br>
+<b>frames:</b> 1<br>
+<b>tables:</b> 1<br>
+<b>cookies:</b> 1<br>
+<b>backgroundsounds:</b> <br>
+<b>vbscript:</b> <br>
+<b>javascript:</b> 1<br>
+<b>javaapplets:</b> 1<br>
+<b>activexcontrols:</b> <br>
+<b>beta:</b> <br>
+<b>crawler:</b> <br>
+<b>authenticodeupdate:</b> <br>
+<b>msn:</b> <br>
+ </programlisting>
+ </simpara>
+
+ <simpara>
+ In order for this to work, your <link
+ linkend="ini.sect.browscap">browscap</link> configuration file
+ setting must point to the correct location of the
+ <filename>browscap.ini</filename> file.
+ </simpara>
+
+ <simpara>
+ For more information (including locations from which you may
+ obtain a <filename>browscap.ini</filename> file), check the PHP
+ FAQ at <ulink
+ url="&url.php.faq;">http://www.php.net/FAQ.html</ulink>.
+ </simpara>
+
+ <note>
+ <simpara>
+ browscap support was added to PHP in version 3.0b2.
+ </simpara>
+ </note>
+
+ </refsect1>
+ </refentry>
+
+
<refentry id="function.ignore-user-abort">
<refnamediv>
<refname>ignore_user_abort</refname>