aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2011-04-29 23:41:29 +0300
committerFilipp Lepalaan <filipp@mac.com>2011-04-29 23:41:29 +0300
commit584981a53ec5c0d1a5b6cf3d4d3f0f374ca6df3f (patch)
tree14e0d49d59af15c162f68167d92601254fc61eca
parent30c626889bcaf69afdff190057b794f89970422c (diff)
downloadgsxlib-584981a53ec5c0d1a5b6cf3d4d3f0f374ca6df3f.tar.gz
gsxlib-584981a53ec5c0d1a5b6cf3d4d3f0f374ca6df3f.tar.bz2
gsxlib-584981a53ec5c0d1a5b6cf3d4d3f0f374ca6df3f.zip
more graceful handling of invalid SN, more complete usage example
-rw-r--r--README.md6
-rw-r--r--gsxlib.php8
2 files changed, 11 insertions, 3 deletions
diff --git a/README.md b/README.md
index 219c973..c5147d7 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/gsxlib.php b/gsxlib.php
index 60a3fc0..c51639c 100644
--- a/gsxlib.php
+++ b/gsxlib.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;
}