Posted by mrsamdk 2 years 5 days ago
Hey all,
I just started trying to mess around with the PHP API and the evaluation json downloaded from deviceatlas.
I'm pretty new to all of this, so I might be doing something wrong and have been looking at the following tutorial for guidance: http://mobiforge.com/developing/story/the-deviceatlas-api-php-part-i-the-basics
The first thing I wanted to do was to pull out some different values, like vendor, displayHeight etc and to start of with echo out displaywidth. I did this by doing the following:
<?php
try{
$vendor = Mobi_Mtld_DA_Api::getProperty($tree, $ua, 'vendor');
$model = Mobi_Mtld_DA_Api::getProperty($tree, $ua, 'model');
$d_height = Mobi_Mtld_DA_Api::getProperty($tree, $ua, 'displayHeight');
$d_width = Mobi_Mtld_DA_Api::getProperty($tree, $ua, 'displayWidth');
$pngSupport = Mobi_Mtld_DA_Api::getProperty($tree, $ua, 'image.Png');
} catch (Mobi_Mtld_Da_Exception_InvalidPropertyException $e) {
$vendor = "Unknown";
$model = "Unknown";
$d_height = "Unknown";
$d_width = "Unknown";
$pngSupport = "Unknown";
}
echo "- ".$d_width."";
?>I visited the test page with my Iphone and got a 320px width which seems correct. I then tested it on three other phones. The X1, Sony Ericsson W995 + W302 and on all three I got my fallback - "Unknown"
Is this because of restricted access in the evaluation json?




Posted by daniel.hunt 2 years ago
Mobile Grandmaster
The evaluation JSON is not restricted in that way at the moment, no.
Have you updated the data file that came in the API zip you downloaded? The file included with the API is a (very) old data file that should be used for testing only, not for evaluation or development.
If you replace the file with the one you download from your user account page on deviceatlas.com, do you still see the same problem?
Daniel
Daniel HuntdotMobi