dotMobimobiThinkingmobiForgemobiReadyDeviceAtlasgoMobi

Posted by jhaneke 3 years 21 weeks ago

pic
 jhaneke
mobiForge Enthusiast
Posts: 14
Joined: 3 years ago
[offline]

Hello,

I'm testing your api and the properties you list on your website are not the same properties I am getting on the actual device.

1. Palm Centro

on web:
Image . Gif87 False
Image GIF89A False
Image PNG False

on device
Image . Gif87 1
Image GIF89A 1
Image PNG 1

2. LG Shine

hardly lists any properties at all on device when I use print_r($properties). does not include the important things I need like xhtml support, display width...even though they are properties with values in your web listing

I have a developers json file but it is only a week old

Posted by daniel.hunt 3 years ago

pic
 daniel.hunt
dotMobi logo
Mobile Grandmaster
Posts: 230
Joined: 4 years ago
[offline]

Hey, welcome to mobiforge!

I've taken a look, and the deviceatlas page for the Palm Centro definitely says that Image.Gif87 is not supported (ie: False)

I also checked this device against the currently available version of our JSON file, and the value it returns is correct!

So we can try to sort this our for you, can you tell me if you are using a newly downloaded JSON file, or if you are using the one that came packaged with the API?

Daniel Hunt
dotMobi

Posted by jhaneke 3 years ago

pic
 jhaneke
mobiForge Enthusiast
Posts: 14
Joined: 3 years ago
[offline]

I'm using a file:

Sample.json dated 7.30.08

I can log back in to device anywhere and send you a screenshot of what I'm seeing

Thanks

Posted by daniel.hunt 3 years ago

pic
 daniel.hunt
dotMobi logo
Mobile Grandmaster
Posts: 230
Joined: 4 years ago
[offline]

Well I'd guess that the reason you're not seeing the correct data is because you're using a JSON file that was created back in July :)

If you login to deviceatlas.com you should be able to download an updated JSON to test with. We package an old version of the JSON file to help developers get up and running as quickly as possible, if you want updated data, you need to update your JSON!

Daniel Hunt
dotMobi

Posted by jhaneke 3 years ago

pic
 jhaneke
mobiForge Enthusiast
Posts: 14
Joined: 3 years ago
[offline]

Thanks,

I downloaded the new json file and uploaded it tom server:

20080916.json

1. I renamed it Sample.json...and it doesn't work

2. I also tried changing this line of code:

$tree = Mobi_Mtld_DA_Api::getTreeFromFile("json/20080916.json");

and no luck..I save the old (7.30.08) Sample.json file as Sample2.json and everything works when I change back to that file.

Do I need to update the api in some way?

Its the latest php api
(http://deviceatlas.com/getAPI/php)

Posted by daniel.hunt 3 years ago

pic
 daniel.hunt
dotMobi logo
Mobile Grandmaster
Posts: 230
Joined: 4 years ago
[offline]
  1. What are the errors that you're getting with the new JSON file?
  2. What OS are you running the api on?

Could double check the permissions on the new JSON file? I've just tested the latest API and JSON file here and it failed because the webserver didn't have permission to read the new file. Once I granted permissions to normal users, everything was fine again!

Daniel

Daniel Hunt
dotMobi

Posted by jhaneke 3 years ago

pic
 jhaneke
mobiForge Enthusiast
Posts: 14
Joined: 3 years ago
[offline]

Hello,

1. Both the old and the new json files have permissions of 644.

2. This page (new json) yields an error: http://www.bmobilehost.com/dd/mobi_new.php

This page contains the following errors:

error on line 1 at column 37: Extra content at the end of the document
Below is a rendering of the page up to the first error.

3. This page (old json) works: http://www.bmobilehost.com/dd/mobi_old.php

4. page code:

<?php

header ("Cache-Control: max-age=200 ");
header ("Content-Type: application/xhtml+xml ");
echo '<?xml version="1.0" encoding="utf-8"?>';

include 'Mobi/Mtld/DA/Api.php';

$memcache_enabled = extension_loaded("memcache");
$no_cache = array_key_exists("nocache", $_GET);
if ($memcache_enabled && !$no_cache) {
$memcache = new Memcache;
$memcache->connect('localhost', 11211);
$tree = $memcache->get('tree');
}

if (!is_array($tree)) {
$tree = Mobi_Mtld_DA_Api::getTreeFromFile("json/Sample2.json");
if ($memcache_enabled && !$no_cache) {
$memcache->set('tree', $tree, false, 10);
}
}

if ($memcache_enabled && !$no_cache) {
$memcache->close();
}

$ua = $_SERVER['HTTP_USER_AGENT'];
$properties = Mobi_Mtld_DA_Api::getProperties($tree, $ua);
?>

Welcome Standard xhtml Users.

<?php print_r($properties); ?>

Posted by daniel.hunt 3 years ago

pic
 daniel.hunt
dotMobi logo
Mobile Grandmaster
Posts: 230
Joined: 4 years ago
[offline]

I've just downloaded both of your JSON files and re-run my tests using them directly, instead of my normal ones. Both tests passed!

Tell me, are you unzipping the JSON archives on your own machine, and then transferring them to your test machine? I'd guess that the error:

Quote:
error on line 1 at column 37: Extra content at the end of the document

is being caused by some newline trickeriness going on during the transfer of the file (if you're doing this at all)

But again, I'm having absolutely no problems with either your Sample.json, or your Sample2.json files (from the examples that you just linked me to)

Daniel Hunt
dotMobi

Posted by atrasatti 3 years ago

pic
 atrasatti
dotMobi logo
Mobile Genius
Posts: 325
Joined: 5 years ago
[offline]

Quote:
This page contains the following errors:

error on line 1 at column 37: Extra content at the end of the document
Below is a rendering of the page up to the first error.

I get this same error when using Safari and if I try to view the page source it's empty.
On the other hand, using Firefox I can see the page source and it is:

<?xml version="1.0" encoding="utf-8"?>

Nothing else.

Are you sure there are no errors logged in your webserver error.log or php error log?

Posted by daniel.hunt 3 years ago

pic
 daniel.hunt
dotMobi logo
Mobile Grandmaster
Posts: 230
Joined: 4 years ago
[offline]

Quote:
I get this same error when using Safari and if I try to view the page source it's empty.

I'm using Firefox and I see the error :)

Daniel Hunt
dotMobi

Posted by jhaneke 3 years ago

pic
 jhaneke
mobiForge Enthusiast
Posts: 14
Joined: 3 years ago
[offline]

Thanks for checking,

I got these errors originally when I called specific properties that were not available in a web browser ( so i switched to print_r($properties)...it seems to be that php is failing to execute because of the json file and then not rendering the page which causes an xhtml error

I'm on mac os x and the json zip file automatically unzips during the download

I tested - http://www.bmobilehost.com/dd/mobi_new.php - on

MAC OSX
safari - error
firefox - error

WINDOWS VISTA
Internet explorer - for some strange reason it wants to download both my new and old file
Firefox - error

Daniel,

what permissions number does your json file have on your test server?

Posted by daniel.hunt 3 years ago

pic
 daniel.hunt
dotMobi logo
Mobile Grandmaster
Posts: 230
Joined: 4 years ago
[offline]

I do my testing on my Linux (Ubuntu) dev box, using Firefox 3
I'd imagine that the new line issue wouldn't affect you if you're using a Mac, but just to confirm it I'll ask Andrea to test it tomorrow morning.

As for the file permissions - when I extracted the JSON file it was 600, which I then made 644 to allow apache to see the file. I'll run some more tests on the pages and JSON files when I get into work in the morning, and I'll make sure everything looks ok using wget too, just incase! :)

Daniel Hunt
dotMobi

Posted by jhaneke 3 years ago

pic
 jhaneke
mobiForge Enthusiast
Posts: 14
Joined: 3 years ago
[offline]

Thanks

I reverted to the api out of the box and simply replaced the json file with the latest download and ..no luck.
I also tried downloading the json file on windows to see if the download process affected the file..no luck

http://www.bmobilehost.com/dd/sample/mobi_new.php
Sample.json permissions 644

http://www.bmobilehost.com/dd/sample/mobi_old.php
Sample2.json permissions 644

API CODE:

<?php
include '../Mobi/Mtld/DA/Api.php';

echo '

';
 
$s = microtime(true);
 
$memcache_enabled = extension_loaded("memcache");
$no_cache = array_key_exists("nocache", $_GET);
if ($memcache_enabled && !$no_cache) {
  $memcache = new Memcache;
  $memcache->connect('localhost', 11211);
  $tree = $memcache->get('tree');
}
 
if (!is_array($tree)) {
  $tree = Mobi_Mtld_DA_Api::getTreeFromFile("json/Sample.json");
  if ($memcache_enabled && !$no_cache) {
    $memcache->set('tree', $tree, false, 10);
  }
}
 
if ($memcache_enabled && !$no_cache) {
  $memcache->close();
}
 
$properties = Mobi_Mtld_DA_Api::getProperties($tree, $_SERVER['HTTP_USER_AGENT']);
//further performance can be gained through caching the properties against the user-agent as a key (since many requests are likely to come from one device during its visit)
 
$e = microtime(true);
print "Time taken: " . floor(($e - $s)*1000) . "ms\r\n";
 
print_r($properties);
 
echo '

';
?>

Posted by daniel.hunt 3 years ago

pic
 daniel.hunt
dotMobi logo
Mobile Grandmaster
Posts: 230
Joined: 4 years ago
[offline]

This is definitely strange. I've just re-downloaded the latest version of the PHP API, as well as both of your json files (Sample.json and Sample2.json).

I'm having absolutely no problems whatsoever :) I'll chat to Andrea when he gets in and ask him to do the same test.

Daniel Hunt
dotMobi

Posted by jhaneke 3 years ago

pic
 jhaneke
mobiForge Enthusiast
Posts: 14
Joined: 3 years ago
[offline]

Solution..
After installing the wurfl and tera wurfl and having them fail, I found a clue in the tera wurfl config

my server has an 8M memory limit, so when the json file or the wurfl.xml file exceeded that it failed silently

so I added this php code and it worked:

ini_set('memory_limit','50M');

now on to testing the parameters on the devices

Posted by daniel.hunt 3 years ago

pic
 daniel.hunt
dotMobi logo
Mobile Grandmaster
Posts: 230
Joined: 4 years ago
[offline]

Bloody hell - thanks for telling us how you sorted it out!
I think that that may be in the DeviceAtlas FAQ, I'll have to double check though. If not, it will definitely be going in!

Daniel

Daniel Hunt
dotMobi

Posted by atrasatti 3 years ago

pic
 atrasatti
dotMobi logo
Mobile Genius
Posts: 325
Joined: 5 years ago
[offline]

JGASPARD wrote:
my server has an 8M memory limit, so when the json file or the wurfl.xml file exceeded that it failed silently

8M is surely a low limit. I am surprised about the "silent failure", it's a PHP error and PHP should log it either in your webserver's error logs or in php.log or to screen, depending on your php.ini file.

I agree with Daniel this is worth an FAQ entry.