diff options
author | Filipp Lepalaan <filipp@mac.com> | 2011-04-29 23:41:29 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2011-04-29 23:41:29 +0300 |
commit | 584981a53ec5c0d1a5b6cf3d4d3f0f374ca6df3f (patch) | |
tree | 14e0d49d59af15c162f68167d92601254fc61eca | |
parent | 30c626889bcaf69afdff190057b794f89970422c (diff) | |
download | gsxlib-584981a53ec5c0d1a5b6cf3d4d3f0f374ca6df3f.tar.gz gsxlib-584981a53ec5c0d1a5b6cf3d4d3f0f374ca6df3f.tar.bz2 gsxlib-584981a53ec5c0d1a5b6cf3d4d3f0f374ca6df3f.zip |
more graceful handling of invalid SN, more complete usage example
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | gsxlib.php | 8 |
2 files changed, 11 insertions, 3 deletions
@@ -8,7 +8,7 @@ validation (as opposed to burdening Apple's servers with totally invalid request ##Requrements## Your PHP should have SOAP support enabled. Most distributions should (including OS X Server 10.6 or later). -For more details, consult your distribution or http://php.net/manual/en/book.soap.php. +For more details, consult your distribution or the [PHP documentation][2]. ##Usage## @@ -19,7 +19,8 @@ Best illustrated with a simple example: include 'gsxlib/gsxlib.php'; $gsx = new GsxLib('your sold-to account', 'gsx user', 'password'); $info = $gsx->warrantyStatus('serialnumber'); - + echo $info->productDescription; + > MacBook Pro (15-inch 2.4/2.2GHz) ?> @@ -37,3 +38,4 @@ Best illustrated with a simple example: 0. You just DO WHAT THE FUCK YOU WANT TO. [1]: http://gsxwsut.apple.com/apidocs/html/WSReference.html?user=asp +[2]: http://php.net/manual/en/book.soap.php @@ -95,7 +95,13 @@ class GsxLib 'unitDetail' => array('serialNumber' => $serialNumber) )); - $result = $this->client->WarrantyStatus($a); + try { + $result = $this->client->WarrantyStatus($a); + } catch (SoapFault $e) { + trigger_error($e->getMessage()); + return FALSE; + } + return $result->WarrantyStatusResponse->warrantyDetailInfo; } |