czesc.
uzywal ktos moze czegos takiego jak WURFL ? http://wurfl.sourceforge.net/
po krotce to taka klasa ktora na podstawie naglowkow wyslanych przez przegladarke (telefon, palmtopa) zwraca nam jego parametry. zainstalowalem to ,ale cos kiepsko mi dziala, wywala mi strone wap ze plik niezgodny z xml
wycinek logu:
Kod
Tue, 31 Jan 2006 12:20:09 +0100 [135.v.tld.pl 26724][constructor] Class Initiated
Tue, 31 Jan 2006 12:20:09 +0100 [135.v.tld.pl 26724][GetDeviceCapabilitiesFromAgent] searching for SEC-SGHE300
Tue, 31 Jan 2006 12:20:09 +0100 [135.v.tld.pl 26724][GetDeviceCapabilitiesFromAgent] WURFL is not loaded, now loading
Tue, 31 Jan 2006 12:34:58 +0100 [135.v.tld.pl 6570][constructor] Class Initiated
Tue, 31 Jan 2006 12:34:58 +0100 [135.v.tld.pl 6570][GetDeviceCapabilitiesFromAgent] searching for Nokia6610/1.0 (5.52) Profile/MIDP-1.0 Configuration/CLDC-1.0
Tue, 31 Jan 2006 12:34:58 +0100 [135.v.tld.pl 6570][GetDeviceCapabilitiesFromAgent] WURFL is not loaded, now loading
Tue, 31 Jan 2006 12:36:49 +0100 [135.v.tld.pl 7985][constructor] Class Initiated
Tue, 31 Jan 2006 12:36:49 +0100 [135.v.tld.pl 7985][GetDeviceCapabilitiesFromAgent] searching for Nokia6610/1.0 (5.52) Profile/MIDP-1.0 Configuration/CLDC-1.0
Tue, 31 Jan 2006 12:36:49 +0100 [135.v.tld.pl 7985][GetDeviceCapabilitiesFromAgent] WURFL is not loaded, now loading



po wlaczeniu cache :
Kod
Tue, 31 Jan 2006 13:26:41 +0100 [135.v.tld.pl 21266][GetDeviceCapabilitiesFromAgent] searching for SEC-SGHE300
Tue, 31 Jan 2006 13:26:41 +0100 [135.v.tld.pl 21266][GetDeviceCapabilitiesFromAgent] cache enabled, WURFL is not loaded, now loading
Tue, 31 Jan 2006 13:26:41 +0100 [135.v.tld.pl 21266][GetDeviceCapabilitiesFromAgent] loading WURFL from cache
Tue, 31 Jan 2006 13:26:41 +0100 [135.v.tld.pl 21266][GetDeviceCapabilitiesFromAgent] Searching in the agent database
Tue, 31 Jan 2006 13:26:41 +0100 [135.v.tld.pl 21266][GetDeviceCapabilitiesFromAgent] WARNING: I couldn't find the device in my list, the headers are my last chance
Tue, 31 Jan 2006 13:26:41 +0100 [135.v.tld.pl 21266][_WriteFastAgentToId] Created temp file data/agent2id.php443df5781a85f76.42447410
Tue, 31 Jan 2006 13:26:41 +0100 [135.v.tld.pl 21266][_WriteFastAgentToId] Done caching user_agent to wurfl_id
Tue, 31 Jan 2006 13:26:41 +0100 [135.v.tld.pl 21266][_GetFullCapabilities] searching for generic
Tue, 31 Jan 2006 13:26:41 +0100 [135.v.tld.pl 21266][_GetDeviceCapabilitiesFromId] reading id:generic
Tue, 31 Jan 2006 13:26:41 +0100 [135.v.tld.pl 21266][_GetDeviceCapabilitiesFromId] ERROR: the id generic is not present in wurfl_agents

tak jakby tego pliku xml nie widział

czesc skryptu:
  1. <?php
  2.  
  3. require_once('wurfl_config.php'); // include the configuration, make sure to configure it properly
  4. require_once(WURFL_CLASS_FILE); // include the main class. This is defined in the configuration file
  5.  
  6. $myDevice = new wurfl_class($wurfl, $wurfl_agents);
  7.  
  8. $myDevice->GetDeviceCapabilitiesFromAgent($_SERVER["HTTP_USER_AGENT"]);
  9.  
  10. if ( $myDevice->browser_is_wap ) $tresc.='wap_ok';
  11. else $tresc.='wap_nook';
  12.  
  13. ?>

oba sprawdzane telefony sa w pliku xml z danymi