tera_wurfl
[ class tree: tera_wurfl ] [ index: tera_wurfl ] [ all elements ]

Source for file check_wurfl.php

Documentation is available at check_wurfl.php

  1. <form action="check_wurfl.php" method="GET">
  2. Mobile device user agent:<br />
  3. <input type="text" name="force_ua" size="100" value="<?=$_GET['force_ua']?>">
  4. </form>
  5. Try some of these:
  6. <ul>
  7.   <li><pre>SonyEricssonK700i/R2AC SEMC-Browser/4.0.2 Profile/MIDP-2.0 Configuration/CLDC-1.1</pre></li>
  8.   <li><pre>MOT-T720/S_G_05.30.0CR MIB/2.0 Profile/MIDP-1.0 Configuration/CLDC-1.0</pre></li>
  9.   <li><pre>SAGEM-myX5-2/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.0 UP.Browser/6.2.2.6.d.2 (GUI) MMP/1.0</pre></li>
  10.   <li><pre>NokiaN90-1/3.0541.5.2 Series60/2.8 Profile/MIDP-2.0 Configuration/CLDC-1.1</pre></li>
  11. </ul>
  12. <hr size="1" />
  13. <?php
  14. /*
  15.  * $Id: check_wurfl.php,v 1.1.2.1.2.3 2007/01/22 22:42:13 kamermans Exp $
  16.  * $RCSfile: check_wurfl.php,v $ v2.1 beta2 (Apr, 16 2005)
  17.  *
  18.  * Author: Andrea Trasatti ( atrasatti AT users DOT sourceforge DOT net )
  19.  * Modified by Steve Kamerman for testing in Tera-WURFL
  20.  *
  21.  */
  22.  
  23.  
  24. list($usec$secexplode(" "microtime());
  25. $start ((float)$usec + (float)$sec)
  26.  
  27. require_once('./tera_wurfl_config.php');
  28. require_once(WURFL_CLASS_FILE);
  29.  
  30. list($usec$secexplode(" "microtime());
  31. $load_class ((float)$usec + (float)$sec)
  32.  
  33. $wurflObj new tera_wurfl();
  34.  
  35. list($usec$secexplode(" "microtime());
  36. $init_class ((float)$usec + (float)$sec)
  37.  
  38. if isset($_GET['force_ua']&& strlen($_GET['force_ua'])>{
  39.     $wurflObj->GetDeviceCapabilitiesFromAgent($_GET['force_ua']);
  40. else {
  41.     //Forcing a test agent
  42.     $wurflObj->GetDeviceCapabilitiesFromAgent("MOT-c350");
  43. }
  44.  
  45. list($usec$secexplode(" "microtime());
  46. $end ((float)$usec + (float)$sec)
  47.  
  48. echo "Time to load tera_wurfl_class.php:".($load_class-$start)."<br>\n";
  49. echo "Time to initialize class:".($init_class-$load_class)."<br>\n";
  50. echo "Time to find the user agent:".($end-$init_class)."<br>\n";
  51. echo "Total:".($end-$start)."<br>\n";
  52. $cached ($wurflObj->found_in_cache)"<strong>(Found in cache)</strong>""";
  53. echo "<br>Total Queries: ".$wurflObj->num_queries." $cached<br>\n";
  54.  
  55.  
  56. if($wurflObj->device_image != ""){
  57.     echo '<img src="'.$wurflObj->device_image.'" /><br />';
  58. }else{
  59.     echo "<strong>No device image available.</strong><br />";
  60. }
  61.  
  62. echo "<pre>";
  63. var_export($wurflObj->capabilities);
  64. echo "</pre>";
  65.  
  66. ?>
  67. <form action="check_wurfl.php" method="GET">
  68. Mobile device user agent:<input type="text" name="force_ua" size="100">
  69. </form>

Documentation generated on Fri, 27 Apr 2007 12:10:13 -0400 by phpDocumentor 1.3.1