Hi,
I followed your aweber faq here http://www.chronoengine.com/faqs/4050-how-can-i-send-form-results-to-aweber.html but can't seem to get this to work.
I get nothing in the debug area after form submission indicating that anything happened, and my tests aren't added to the list.
Not sure where to go from here...
The form can be accessed here http://jacquifit.com/index.php?option=com_chronoforms&tmpl=component&chronoform=aweber-opt-in
I have the following in a custom code event in "on submit" after emails:
[code]
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
// set $debug = true to generate diagnostic output
$debug = true;
// this is file is from the AWeber Developer Lab
include JPATH_SITE.DS.'components'.DS.'com_chronoforms'.DS.'extras'.DS.'aweber_api'.DS.'aweber_api.php';
// Replace with the keys of your application
// NEVER SHARE OR DISTRIBUTE YOUR APPLICATIONS'S KEYS!
$consumerKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$consumerSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$accessToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
$accessTokenSecret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$list_name = 'xxxxxxxxxxxx'; // put the AWeber List Name here
$aweber = new AWeberAPI( $consumerKey, $consumerSecret );
$account = $aweber->getAccount( $accessToken, $accessTokenSecret );
// set this to true to view the actual api request and response
if ( $debug ) $aweber->adapter->debug = true;
try {
// get the list object for the named list
$foundLists = $account->lists->find( array( 'name' => $list_name ) );
$list = $foundLists[0];
// create a subscriber
$params = array(
'email' => $form->data['email'],
'name' => $form->data['name'
);
$subscribers = $list->subscribers;
$new_subscriber = $subscribers->create( $params );
// success!
if ( $debug ) print "A new subscriber was added to the $list->name list!";
} catch( AWeberAPIException $exc ) {
if ( $debug ) {
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>";
}
}
?>
[/code]
I'm sure I'm missing something...
Thanx.
Mark
I followed your aweber faq here http://www.chronoengine.com/faqs/4050-how-can-i-send-form-results-to-aweber.html but can't seem to get this to work.
I get nothing in the debug area after form submission indicating that anything happened, and my tests aren't added to the list.
Not sure where to go from here...
The form can be accessed here http://jacquifit.com/index.php?option=com_chronoforms&tmpl=component&chronoform=aweber-opt-in
I have the following in a custom code event in "on submit" after emails:
[code]
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
// set $debug = true to generate diagnostic output
$debug = true;
// this is file is from the AWeber Developer Lab
include JPATH_SITE.DS.'components'.DS.'com_chronoforms'.DS.'extras'.DS.'aweber_api'.DS.'aweber_api.php';
// Replace with the keys of your application
// NEVER SHARE OR DISTRIBUTE YOUR APPLICATIONS'S KEYS!
$consumerKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$consumerSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$accessToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
$accessTokenSecret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$list_name = 'xxxxxxxxxxxx'; // put the AWeber List Name here
$aweber = new AWeberAPI( $consumerKey, $consumerSecret );
$account = $aweber->getAccount( $accessToken, $accessTokenSecret );
// set this to true to view the actual api request and response
if ( $debug ) $aweber->adapter->debug = true;
try {
// get the list object for the named list
$foundLists = $account->lists->find( array( 'name' => $list_name ) );
$list = $foundLists[0];
// create a subscriber
$params = array(
'email' => $form->data['email'],
'name' => $form->data['name'
);
$subscribers = $list->subscribers;
$new_subscriber = $subscribers->create( $params );
// success!
if ( $debug ) print "A new subscriber was added to the $list->name list!";
} catch( AWeberAPIException $exc ) {
if ( $debug ) {
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>";
}
}
?>
[/code]
I'm sure I'm missing something...
Thanx.
Mark