<?phprequire_once('aweber_api/aweber_api.php');// Put the consumer key and secret from your App on labs.aweber.com below.$consumerKey='****';$consumerSecret='****';$aweber=newAWeberAPI($consumerKey,$consumerSecret);// Put the callback URL of your app below or set to 'oob' if your app isnt// a web based application.$callbackURL='https://www.example.com/your_application_callback_url';// get a request tokenlist($key,$secret)=$aweber->getRequestToken($callbackURL);

1
2
3
4
5
6
7
8
9
10

fromaweber_apiimportAWeberAPIconsumer_key="*****"consumer_secret="*****"callback_url='https://www.example.com/your_application_callback_url'aweber=AWeberAPI(consumer_key,consumer_secret)# get a request tokenkey,secret=aweber.get_request_token(callback_url)

<?phprequire_once('aweber_api/aweber_api.php');// Put the consumer key and secret from your App on labs.aweber.com below.$consumerKey='****';$consumerSecret='****';$aweber=newAWeberAPI($consumerKey,$consumerSecret);// Put the callback URL of your app below or set to 'oob' if your app isnt// a web based application.$callbackURL='https://www.example.com/your_application_callback_url';// get a request tokenlist($key,$secret)=$aweber->getRequestToken($callbackURL);// get the authorization URL$authorizationURL=$aweber->getAuthorizeUrl();// store the request token secretsetcookie('secret',$secret);// redirect user to authorization URLheader("Location: $authorizationURL");exit();

<?phprequire_once('aweber_api/aweber_api.php');// Put the consumer key and secret from your App on labs.aweber.com below.$consumerKey='****';$consumerSecret='****';$aweber=newAWeberAPI($consumerKey,$consumerSecret);// Pull the request token key and verifier code from the URL$aweber->user->requestToken=$_GET['oauth_token'];$aweber->user->verifier=$_GET['oauth_verifier'];// retrieve the stored request token secret$aweber->user->tokenSecret=$_COOKIE['secret'];// Exchange a request token with a verifier code for an access token.list($accessTokenKey,$accessTokenSecret)=$aweber->getAccessToken();

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

fromaweber_apiimportAWeberAPIfrompylonsimportsession,request# Put the consumer key and secret from your App on labs.aweber.com below.consumer_key='****'consumer_secret='****'aweber=AWeberAPI(consumer_key,consumer_secret)# Pull the request token key and verifier code from the requestaweber.user.request_token=request.params['oauth_token']aweber.user.verifier=request.params['oauth_verifier']# retrieve the stored request token secretaweber.user.token_secret=session['request_token_secret']# Exchange a request token with a verifier code for an access token.access_token,access_secret=aweber.get_access_token()

<?php# Complete example on how to parse an authorization code.# Refer to our getting started guide for a complete API walkthrough# https://labs.aweber.com/snippets/gs/using_the_apirequire_once('aweber_api/aweber_api.php');try{# set $authorization_code to the code that is given to you from# https://auth.aweber.com/1.0/oauth/authorize_app/YOUR_APP_ID$authorization_code="Az12...|234k...|Aq53...|ka4l...|aj3ksf|";$auth=AWeberAPI::getDataFromAweberID($authorization_code);list($consumerKey,$consumerSecret,$accessKey,$accessSecret)=$auth;# Store the Consumer key/secret, as well as the AccessToken key/secret# in your app, these are the credentials you need to access the API.}catch(AWeberAPIException$exc){print"<h3>AWeberAPIException:</h3>";print" <li> Type: $exc->type <br>";print" <li> Msg : $exc->message <br>";print" <li> Docs: $exc->documentation_url <br>";print"<hr>";}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

# Complete example on how to parse an authorization code.# Refer to our getting started guide for a complete API walkthrough# https://labs.aweber.com/snippets/gs/using_the_apifromaweber_apiimportAWeberAPI,APIException# set authorization_code to the code that is given to you from# https://auth.aweber.com/1.0/oauth/authorize_app/YOUR_APP_IDauthorization_code="Az12...|234k...|Aq53...|ka4l...|aj3ksf|"try:auth=AWeberAPI.parse_authorization_code(authorization_code)consumer_key,consumer_secret,access_key,access_secret=authexceptAPIException,exc:(exc_type,exc_msg)=str(exc).split(': ',1)print'<h3>APIException:</h3>'print' <li> Type: '+exc_typeprint' <li> Msg: '+exc_msgprint' <li> Docs: '+str(exc)print'<hr>'