I've got a user's old iPhone that has been deactivated, and she has a new iPhone. Her son tried to sync it to grab the contacts off of it but "it didn't work" (not sure what happened, or what didn't work, but that's the situation). I've looked everywhere, and can't find a good free solution (or a really good paid one) to get all of her contacts off the phone. I downloaded a trial of ABC Amber iPhone something-or-other and it just got names, no groups or phone numbers. So, I'm building a tool to grab the data from an iPhone backup and make it usable to the owner of the data. (The person using the software is responsible for making sure only the owner uses the data.) I'm focusing on the Address Book first, then I'll work on text messages, emails, settings, etc. The two big things I need to do in order to make it easy for end-users: How do I convert binary plist files using cross-platform PHP? (meaning no use of system only utlitlites like built in OS X bash scripts) How do I query sqlite3 databases? I see some info on php.net, but nothing on how to actually make use of the sqlite3 class Any tips? Yes, this will be open source when I'm done, that way everyone can clean it up and mock me for how lazy I'm being.
Trick with PHP's native classes is to look at the constructor's documentation, in my experience. http://us3.php.net/manual/en/sqlite3.construct.php PHP: ?php$db = new SQLite3('mysqlitedb.db');$db->exec('CREATE TABLE foo (bar STRING)');$db->exec("INSERT INTO foo (bar) VALUES ('This is a test')");$result = $db->query('SELECT bar FROM foo');var_dump($result->fetchArray());?> Also, SQLite3::query : PHP: <?php$db = new SQLite3('mysqlitedb.db');$results = $db->query('SELECT bar FROM foo');while ($row = $results->fetchArray()) { var_dump($row);}?> I have no idea of the address book db's structure, but that should at least give you a rough idea. Unsure about the binary plist files If they were in original XML it would be easy enough using simplexml, but of course all bets are off with the binary version. There's plutil but that's not cross-platform.
Yeah, that's why I'm having a hard time figuring it out... that's normally how I use PHP classes, but SQLite3 seems to be there and not at the same time. I'm using PHP 5.2.8, which is the current stable release. Yeah, plutil on OS X Tiger is what I used to convert everything to plaintext, then I used a standalone sqlite browser to export SQL, that I then cleaned up/adapted for MySQL. Overall it was a pretty miserable experience I'm hoping PHP releases the SQLite3 class soon, because at least there are tons of plutil based scripts to extract the sqlite database.