0

我正在尝试从 aweber 帐户获取列表详细信息,我可以通过硬代码访问密钥获取所有列表,但是如果我想从数据库中获取该怎么办。

这是我的代码:

    $consumerKey    = env('consumerKey');
    $consumerSecret = env('consumerSecret');

    $user_id = \Illuminate\Support\Facades\Auth::user();
          $keys = \Illuminate\Support\Facades  \ DB::table('access_keys')->where('user_id','=', $user_id)->value('accessTokenKey','accessTokenSecret');

    $accessKey      = $keys;
    $accessSecret   = $keys

我从这个查询中获得了无效的访问令牌,并且我已将 accesskey 和 accesssecret 保存到我的数据库中。当我硬编码时,我可以获得所有列表,但我想从数据库中获取:

任何帮助,将不胜感激!

4

1 回答 1

0

首先从 git 获取 Aweber API 代码:- https://github.com/aweber/AWeber-API-PHP-Library

要从 Aweber 帐户获取列表,您需要遵循以下详细信息:-

require_once('aweber_api/aweber_api.php');
$consumerKey    = "YOUR  CONSUMER KEY";
$consumerSecret = "YOUR CONSUMER SECRET";
$aweber = new AWeberAPI($consumerKey, $consumerSecret);
$accessToken = 'Access token for customer account';
$accessTokenSecret = 'access token secret for customer account';

$account = $aweber->getAccount($accessToken, $accessTokenSecret);

if($account){
      foreach($account->lists as $offset => $list) {
           echo $list->name;
           echo $list->id;
      }
}
于 2018-01-31T11:58:12.080 回答