2013-03-13 5 views
0

나는 https://labs.aweber.com/apps에 앱을 만들고 github에 PHP 코드를 다운로드합니다. 필자는 자신의 문서를 읽었지만 분명하지는 않다. 나는 어떻게 시작해야할지, 무엇을 먼저해야할지 모른다. 임 그냥 초보자와 나는 전에 응용 프로그램을 만들었습니다.Aweber에서 앱을 만드는 방법은 무엇입니까?

폼을 제출할 때 원하는 기능을 충족시키기를 원하지만 내 페이지에 PHP 스크립트를 먼저 만들려고했지만 아무 일도 없었습니다. 나는 그들의 지원에 연락하지만 올바르게 작동하게 만드는 앱을 제안합니다.

웹 양식 제출의 흐름은 다음과 같습니다. 홈페이지에서 사용자는 이름, 이메일, 전화 번호를 입력하고 두 가지 라디오 옵션을 선택할 수 있습니다. 하나를 선택하면 다른 페이지로 리디렉션되고 양식을 다시 작성하여 제출할 수 있습니다. 홈페이지와 두 번째 페이지에 대한 웹 양식을 만들었습니다. 두 번째 페이지에 양식을 제출하면 홈페이지 (이름, 이메일, 전화 및 옵션 선택)에 대한 세부 정보를 받아야합니다. 그러나 내 Aweber 계정의 가입자를 볼 때 두 번째 페이지의 필드는 모두 비어 있습니다. 홈페이지의 입력란이 완성되었고 두 번째 페이지에서 양식을 채우고 제출할 때마다 Aweber는 페이지가 차단되었다고 전합니다.

그들은 그걸 위해 앱을 만들 것을 제안합니다. 그러나 나는 그들의 문서가 정신을 잃기 때문에 시작하는 방법을 모른다.

나를 도와 주시면 정말 고맙겠습니다.

감사합니다.

답변

13

해당 기능에 대한 aweber 앱을 만들어야하는 것처럼 들립니다.

제가 설치 프로그램을 매우 빨리 시작할 수 있도록 도와주는 PHP 코드를 붙여 넣습니다. 브라우저에로드하고 지침을 따르십시오. 실제 API 호출을 할 준비가되면 labs.aweber.com/snippets/subscribers에서 몇 가지 예를 볼 수 있습니다.

문제가 생기면 언제든지 [email protected]으로 aweber API 지원을 이메일로 보낼 수 있습니다.

(당신이 이미하지 않은 경우) 당신이해야 할 몇 가지 :

  1. 을 얻기 위해 응용 프로그램을 만들기 실험실 계정 (http://labs.aweber.com)와 aweber 계정 (http://www.aweber.com)
  2. 만들기 실험실 사이트
  3. 실험실 사이트에서 AWeber의 PHP 라이브러리를 다운로드하고
아래 require_once를()에서의 적절한 경로가 있는지 확인에서 당신의 소비자 키와 비밀 6,
<?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(); 
} 
?> 
+0

감사합니다! 정말 감사합니다. –

+0

제가이 답변을 백 번 투표 할 수 있다면 충분하지 않을 것입니다! 감사합니다. –

+0

이 코드 조각을 가져 주셔서 감사합니다. Aweber API 문서는 최악입니다. – Vincent

관련 문제