Skip to content

borisvaweber/AWeber-API-PHP-Library

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWeber API PHP Library
======================

PHP library for easily integrating with the AWeber API.

Changelog:
----------
2011-12-23: v1.1.2
 * Fixed a bug in the AWeberCollection class to properly set the URL of entries found in collections.

2011-10-10: v1.1.1
 * Raise an E_USER_WARNING instead of a fatal error if multiple instances of the client library are installed.

2011-08-29: v1.1.0
 * Modified client library to raise an AWeberAPIException on any API errors (HTTP status >= 400)
 * Refactored tests for better code coverage
 * Refactored move and create methods to return the resource or raise an AWeberAPIException on error.
 * Added getActivity method to a subscriber entry.

Basic Usage:
------------
Refer to demo.php to see a working example of how to authenticate an app and query the API.

For more complete documentation please refer to:
https://labs.aweber.com/docs/php-library-walkthrough


Handling Errors:
----------------
Sometimes errors happen and your application should handle them appropriately.
Whenever an API error occurs an AWeberAPIException will be raised with a detailed 
error message and documentation link to explain what's wrong.

You should wrap any calls to the API in a try/except block.

Common Errors:
 * Resource not found (404 error)
 * Your application has been rate limited (403 error)
 * Bad request (400 error)
 * API Temporarily unavailable (503 error)

Refer to https://labs.aweber.com/docs/troubleshooting for the complete list

Example Below:

<?php

$consumerKey = '***';
$consumerSecret = '***';
$accessKey = '***';
$accessSecret = '***';

$aweber = new AWeberAPI($consumerKey, $consumerSecret);
$account = $aweber->getAccount($accessKey, $accessSecret);

try {
    $resource = $account->loadFromUrl('/accounts/idontexist');
} catch (AWeberAPIException $exc) {
    print "<li> $exc->type on $exc->url, refer to $exc->message for more info ...<br>";
}

?>

About

PHP Library to easily integrate with AWeber's API

Resources

License

Stars

Watchers

Forks

Packages

No packages published