Mundo Posted November 1, 2009 Share Posted November 1, 2009 I'm using an XML database called WURFL - it can be found here: http://wurfl.sourceforge.net/index.php I want to use this to find out if a device can support either xHTML or WML and the resolution of the screen. Can anybody help me with this? I've got something like this but I'm a bit stuck... <?php $agent = $_SERVER['HTTP_USER_AGENT']; $xml = simplexml_load_file('wurfl.xml'); echo "Prefered Markup: " . $xml->$agent->preferred_markup; echo "Maximum screen width: " . $xml->$agent->screenwidth . "px"; ?> Link to comment https://forums.phpfreaks.com/topic/179858-simplexml/ Share on other sites More sharing options...
Mundo Posted November 1, 2009 Author Share Posted November 1, 2009 I know it's something to do with the following: $xml->$agent->screenwidth But I don't know the format it should be in? Could someone more knowledgeable download the WURFL file and tell me? Link to comment https://forums.phpfreaks.com/topic/179858-simplexml/#findComment-948824 Share on other sites More sharing options...
Mundo Posted November 2, 2009 Author Share Posted November 2, 2009 For example, an entry from the XML file is: <device id="nokia_3330_ver1" user_agent="Nokia3330" fall_back="nokia_generic_series20" actual_device_root="true"> <group id="product_info"> <capability name="model_name" value="3330" /> </group> <group id="storage"> <capability name="max_deck_size" value="2800" /> </group> <group id="object_download"> <capability name="wallpaper_gif" value="true" /> </group> <group id="display"> <capability name="max_image_height" value="36" /> </group> <group id="markup"> <capability name="xhtml_support_level" value="-1" /> <capability name="preferred_markup" value="wml_1_1" /> </group> <group id="streaming"> <capability name="streaming_real_media" value="none" /> </group> </device> How would I lookup "preferred_markup" depending on the HTTP_USER_AGENT with the SimpleXML features? Link to comment https://forums.phpfreaks.com/topic/179858-simplexml/#findComment-948972 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.