Skip to content

Instantly share code, notes, and snippets.

@spookylukey
Created November 12, 2013 21:06
Show Gist options
  • Save spookylukey/7438702 to your computer and use it in GitHub Desktop.
Save spookylukey/7438702 to your computer and use it in GitHub Desktop.
// Example using official client (condensed)
require_once('apiclient/pmapirequest.class.inc');
require_once('apiclient/pmapiauthnone.class.inc');
require_once('apiclient/pmapiauthtoken.class.inc');
$request = new PMAPIRequest(new PMAPIAuthNone());
$response = $request->token->post(array('username' => 'my_api_user@example.com',
'password' => 'my_strong_password'));
if($response->isError)
{
die("Failed to obtain token: {$response->error}\n");
}
$token = $response->data['token'];
$expiry = $response->data['expiry'];
$request = new PMAPIRequest(new PMAPIAuthToken($token));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment