Git Product home page Git Product logo

aweber-api-php-library's Introduction

This client library has been deprecated.

This library will no longer be supported and does not support OAuth2.

Please visit our PHP Examples as a reference.


AWeber API PHP Library Build Status

PHP library for easily integrating with the AWeber API.

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 is wrong.

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

Common Errors:

  • Bad request (400 error)
  • Your application is not authorized (401 error)
  • Your application has been rate limited (403 error)
  • Resource not found (404 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>";
}
?>

Accessing personally identifiable subscriber data

In order to view or update the email, name, misc_notes, and ip_address fields of a subscriber, your app must specifically request access to subscriber data. Refer to our documentation at https://labs.aweber.com/docs/permissions for more information on how to be able to access personally identifiable subscriber information.

Changelog:

2017-09-02: v1.1.18

  • Fixing issues on the formatting of nested objects on 'application/json' requests
  • Fixing issue with extra data being sent in header.
  • Fixing issue to allow the creation of custom fields to be sent as form encoded.

2017-08-21: v1.1.17

  • Fixing UTF-8 issues on creates

2016-12-16: v1.1.16

  • Composer autoload with classmap

2016-11-09: v1.1.15

  • Create AWeberEntry for Broadcast Entry endpoint

2015-02-17: v1.1.13

  • Remove double encoding in requests to support utf-8

2014-02-05: v1.1.12

  • Add composer file.

2013-04-25: v1.1.11

  • Fixed a bug in the Collection Find Subscriber method where fetching the next page in the collection had not included the previous search parameters.

  • We've changed how we store collection data internally in AWeberCollection objects to reduce the amount of memory required for large collections.

    To lower memory usage, the AWeberCollection only stores a single page of entries as you iterate thru the collection.

    • foreach and sequential array indexing operations now require less memory.

    • Random access of array elements by indexes will fetch pages of the collection from the API on demand if the collection data is not already in memory.

2013-02-07: v1.1.10

  • Updated APIUnreachableException to provide more diagnostic data.

2013-01-03: v1.1.9

  • Updated client library to support 1.0.17 of the API. (Broadcast Statistics)

2012-12-13: v1.1.8

  • Fixed a bug that resulted in Exceptions being raised when using collections when the collection size is zero.

2012-12-10: v1.1.7

2012-09-19: v1.1.6

  • Fixed a bug that prevented resource attributes from being saved when the initial value of the resource attribute was null.
    • used array_key_exists instead of isset for evaluation of associative arrays. Requires PHP >= 4.0.7

2012-07-05: v1.1.5

  • Fixed a bug were a utf8_encode notice was raised when updating subscriber custom field values.

2012-05-08: v1.1.4 Some API Developers have reported AWeberOAuthDataMissing exceptions when using the demo.php script. This error message is not helpful as the typical cause for this exception is an invalid consumer key or secret.

The client library has been refactored to always raise an AWeberAPIException when a 40x/50x http status code response is returned. This exception will clearly indicate the cause of the error for easier troubleshooting.

  • Refactored makeRequest to always raise an AWeberAPIException when a 40x or 50x status is returned.
  • Refactored makeRequest to indicate transient networking or firewall connectivity issues.
  • Refactored mock adaptor makeRequest for testing to behave the same way as the real makeRequest does.

2012-04-18: v1.1.3

  • Removed usage of deprecated split function.

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.

Running Tests:

Testing the PHP api library requires installation of a few utilities.

Requirements

Apache Ant is used to run the build targets in the build.xml file. Get the latest version.

Setup /etc/php.ini configuration file. Make sure include_path contains the correct directories.(/usr/lib/php on MacOS) Set date.timezone to your local timezone.

Execute Tests

Once the above requirements are installed, make sure to run composer install, this will ensure all the test dependencies are installed.

Run the tests from the base directory using the command: ant.

Individual test can be run by specifying ant targets: ant phpunit, ant phpcs.

aweber-api-php-library's People

Contributors

aremm avatar aweberdang avatar bkorty avatar borisvaweber avatar brettsantore avatar chrismcguire avatar cknave avatar geoffp-aweber avatar nvllsvm avatar pianoman19372 avatar russpos avatar srelsner avatar vrajmohan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.