0

I am using the WURFL library to return device width and height.

I used Safari with iPhone agent but the result is null.

My code is:

$width = $wurfl->getDeviceCapability("resolution_width");
$height = $wurfl->getDeviceCapability("resolution_height");

What is the problem?

Maccath
  • 3,936
  • 4
  • 28
  • 42
Ayman Hussein
  • 3,817
  • 7
  • 28
  • 48

1 Answers1

1

Did you first query the device capabilities using the user agent string $_SERVER['HTTP_USER_AGENT']?

$wurfl = new TeraWurfl();
$wurfl->getDeviceCapabilitiesFromAgent($_SERVER['HTTP_USER_AGENT']);

$width  = (int) $wurfl->getDeviceCapability('resolution_width');
$height = (int) $wurfl->getDeviceCapability('resolution_height');

Using Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3 like Mac OS X; de-de) AppleWebKit/533.17.9 (KHTML, like Gecko) Mobile/8F190 the result of $width is 320 and of $height 480.

Rico Sonntag
  • 1,505
  • 1
  • 15
  • 21