0

https://labs.aweber.com/appsでアプリを作成し、そのgithubhttps://github.com/aweber/AWeber-API-PHP-Libraryでphpコードをダウンロードします。私は彼らのドキュメントを読みましたが、それははっきりしていません。どうやって始めたらいいのか、最初に何をしたらいいのかわからない。私は初心者で、これまでアプリを作成したことはありません。

フォームを送信するときに目的の機能を満たすことを期待して、最初に自分のページでPHPスクリプトを作成しようとしましたが、何も起こりませんでした。私は彼らのサポートに連絡しますが、彼らはそれを正しく動作させるためにアプリを作ることを提案します。

Webフォーム送信の流れはこんな感じでした。ホームページでは、ユーザーは名前、電子メール、電話を入力し、2つのラジオオプションを選択できます。1つを選択すると、別のページにリダイレクトされ、フォームに再度入力して送信します。ホームページと2ページ目にWebフォームを作成しました。2ページ目にフォームを送信すると、ホームページに詳細(名前、メール、電話、オプションの選択)が表示され、機能するようになりました。しかし、Aweberアカウントのサブスクライバーで表示すると、2ページ目のフィールドがすべて空白になります。ホームページのフィールドに入力しました。2ページ目のフォームに入力して送信すると、Aweberはページがブロックされたと言います。

彼らは私がそのためのアプリを作成することを提案します。しかし、彼らのドキュメントは気が遠くなるので、私は始める方法がわかりません。

助けていただければ幸いです。

ありがとう!

4

1 に答える 1

14

その機能のために aweber アプリを作成する必要があるように思えます。

非常に迅速にセットアップするのに役立つ PHP コードを貼り付けています。ブラウザにロードして、指示に従います。実際の API 呼び出しを行う準備ができたら、labs.aweber.com/snippets/subscribers でいくつかの例を参照できます。

問題が発生した場合は、いつでも aweber API サポート (api@aweber.com) に電子メールを送信できます。

あなたがする必要があるいくつかのこと(まだしていない場合):

  1. labs アカウント ( http://labs.aweber.com ) と aweber アカウント ( http://www.aweber.com )を作成します。
  2. ラボ サイトでコンシューマー キーとシークレットを取得するアプリを作成する
  3. ラボ サイトから AWeber php ライブラリをダウンロードし、以下の require_once() に適切なパスがあることを確認します。
<?php
require_once('aweber_api/aweber_api.php');
// Step 1: assign these values from https://labs.aweber.com/apps
$consumerKey = '';
$consumerSecret = '';

// Step 2: load this PHP file in a web browser, and follow the instructions to set
// the following variables:
$accessKey = '';
$accessSecret = '';
$list_id = '';

if (!$consumerKey || !$consumerSecret){
    print "You need to assign \$consumerKey and \$consumerSecret at the top of this script and reload.<br><br>" .
        "These are listed on <a href='https://labs.aweber.com/apps' target=_blank>https://labs.aweber.com/apps</a><br>\n";
    exit;
}

$aweber = new AWeberAPI($consumerKey, $consumerSecret);
if (!$accessKey || !$accessSecret){
    display_access_tokens($aweber);
}

try { 
    $account = $aweber->getAccount($accessKey, $accessSecret);
    $account_id = $account->id;

    if (!$list_id){
        display_available_lists($account);
        exit;
    }

    print "You script is configured properly! " . 
        "You can now start to develop your API calls, see the example in this script.<br><br>" .
        "Be sure to set \$test_email if you are going to use the example<p>";

    //example: create a subscriber
    /*
    $test_email = '';
    if (!$test_email){
    print "Assign a valid email address to \$test_email and retry";
    exit;
    }
    $listURL = "/accounts/{$account_id}/lists/{$list_id}"; 
    $list = $account->loadFromUrl($listURL);
    $params = array( 
        'email' => $test_email,
        'ip_address' => '127.0.0.1',
        'ad_tracking' => 'client_lib_example', 
        'misc_notes' => 'my cool app', 
        'name' => 'John Doe' 
    ); 
    $subscribers = $list->subscribers; 
    $new_subscriber = $subscribers->create($params);
    print "{$test_email} was added to the {$list->name} list!";
    */

} 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>"; 
    exit(1); 
}

function get_self(){
    return 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
}

function display_available_lists($account){
    print "Please add one for the lines of PHP Code below to the top of your script for the proper list<br>" .
            "then click <a href='" . get_self() . "'>here</a> to continue<p>";

    $listURL ="/accounts/{$account->id}/lists/"; 
    $lists = $account->loadFromUrl($listURL);
    foreach($lists->data['entries'] as $list ){
        print "<pre>\$list_id = '{$list['id']}'; // list name:{$list['name']}\n</pre>";
    }
}

function display_access_tokens($aweber){
    if (isset($_GET['oauth_token']) && isset($_GET['oauth_verifier'])){

        $aweber->user->requestToken = $_GET['oauth_token'];
        $aweber->user->verifier = $_GET['oauth_verifier'];
        $aweber->user->tokenSecret = $_COOKIE['secret'];

        list($accessTokenKey, $accessTokenSecret) = $aweber->getAccessToken();

        print "Please add these lines of code to the top of your script:<br>" .
                "<pre>" .
                "\$accessKey = '{$accessTokenKey}';\n" . 
                "\$accessSecret = '{$accessTokenSecret}';\n" .
                "</pre>" . "<br><br>" .
                "Then click <a href='" . get_self() . "'>here</a> to continue";
        exit;
    }

    if(!isset($_SERVER['HTTP_USER_AGENT'])){
        print "This request must be made from a web browser\n";
        exit;
    }

    $callbackURL = get_self();
    list($key, $secret) = $aweber->getRequestToken($callbackURL);
    $authorizationURL = $aweber->getAuthorizeUrl();

    setcookie('secret', $secret);

    header("Location: $authorizationURL");
    exit();
}
?>
于 2013-03-14T17:37:23.880 に答える