diff options
author | Filipp Lepalaan <filipp@mac.com> | 2015-07-31 14:04:51 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2015-07-31 14:04:51 +0300 |
commit | 8ced92e8e91920485ade1b3b9d7fe9a714eadfe9 (patch) | |
tree | 6f50b1da290c5e488f94976b738c1661ad4bc9cf | |
parent | 88b167aaacbe70316fbc563a4a7dbedfab16fd29 (diff) | |
download | gsxlib-8ced92e8e91920485ade1b3b9d7fe9a714eadfe9.tar.gz gsxlib-8ced92e8e91920485ade1b3b9d7fe9a714eadfe9.tar.bz2 gsxlib-8ced92e8e91920485ade1b3b9d7fe9a714eadfe9.zip |
Updated read me
-rw-r--r-- | README.md | 73 |
1 files changed, 58 insertions, 15 deletions
@@ -10,27 +10,30 @@ validation (as opposed to burdening Apple's servers with totally invalid request Requrements =========== -- SOAP support in your PHP installation -- A GSX account with the "Can access Web Services" privilege enabled +- SOAP support in your PHP +- Client certificates for GSX access +- Whitelisted IP address of the source of your requests +- GSX account with the "Can access Web Services" privilege enabled + Usage ===== Best illustrated with a simple example: -```php -<?php - - include 'gsxlib/gsxlib.php'; - $gsx = GsxLib::getInstance($sold_to, $username, $password); - $info = $gsx->warrantyStatus($serialnumber); - echo $info->productDescription; - > MacBook Pro (15-inch 2.4/2.2GHz) + <?php -?> -``` + include 'gsxlib/gsxlib.php'; + $_ENV['GSX_CERT'] = '/path/to/gsx/client/cert.pem'; + $_ENV['GSX_KEYPASS'] = 'MySuperSecretPrivateKeyPassPhrase'; + $gsx = GsxLib::getInstance($sold_to, $username); + $info = $gsx->warrantyStatus($serialnumber); + echo $info->productDescription; + > MacBook Pro (15-inch 2.4/2.2GHz) + + ?> -US users should remember to set the fifth argument of the constructor to 'am'. +If you're in the US, remember to set the fifth argument to the constructor to 'am'. gsxcl @@ -39,8 +42,48 @@ gsxcl The package includes a rudimentary command line client to the GSX API called _gsxcl_. It can perform various functions in the library and is meant mainly as a simple test tool for the library. -##License## - + +FAQ +=== + +### Q: How do I create the necessary PEM file? +A: The PEM file must be a concatenation of the certificate you got from Apple and your private key file. You can create this from the Terminal: + + $ cat Applecare-APP1234-0000123456.Test.apple.com.chain.pem privatekey.pem > certbundle.pem + +After that you would use _certbundle.pem_ as your client certificate. The contents of _certbundle.pem_ should look something like this: + + -----BEGIN CERTIFICATE----- + BLASOQ()*Q#()**)REW)*(EW*)*E)WUR)*EW(UR) + ... + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + 0990320003q43090435J403439590S-S=DS=- + ... + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + )_#_)#)$IK_#@))KDE_)FD_SF)DSF_DS)FDS_FDSFSD + .... + -----END CERTIFICATE----- + -----BEGIN RSA PRIVATE KEY----- + Proc-Type: .... + DEK-Info: ... + BUNCH OF GIBBERISH + -----END RSA PRIVATE KEY----- + + +### Q: Do I need to make changes to my web server configuration for the SSL authentication to work? +A: No, the library takes care of everything. That's why the certificate path and passphrase are implemented as environment variables. This +ensures the certificate is sent with each request and you only have to define the paths once in your code. + +### Q: How can I remove the passphrase from my private key? + + $ openssl rsa -in privatekey.pem -out privatekey.nopass.pem + + +License +======= + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> |