【问题标题】:Getresponse API newsletter not workingGetresponse API 通讯不起作用
【发布时间】:2014-06-10 12:46:41
【问题描述】:

我尝试通过 API 发送 getresponse 时事通讯。它没有按预期工作。我遵循了 https://github.com/GetResponse/DevZone/tree/master/API#send_newsletter

这里是代码http://pastebin.com/tWWKgpF5

我不太确定哪个是错的。

【问题讨论】:

    标签: php api getresponse


    【解决方案1】:

    终于明白了。它可能有用。你可以找到很多例子https://github.com/robertstaddon/GetResponse-PHP-Wrapper/blob/master/PHPwrapper/examples.php

     <?php
     # Demonstrates how to sending newsletter to campaign.
    
     # JSON::RPC module is required
     # available at http://github.com/GetResponse/DevZone/blob/master/API/lib  /jsonRPCClient.php
     require_once 'jsonRPCClient.php';
    
    # your API key is available at
    # https://app.getresponse.com/my_api_key.html
    
    $api_key = 'APIKEY';
    
    # API 2.x URL
    $api_url = 'http://api2.getresponse.com';
    
    # initialize JSON-RPC client
    $client = new jsonRPCClient($api_url);
    
    # find campaign named 'test'
    $campaigns = $client->get_campaigns(
    $api_key,
    array (
        # find by name literally
        'name' => array ( 'EQUALS' => '<enter your campaign name>' )
    )
     );
    
    # uncomment following line to preview Response
    print_r($campaigns);
    
    # because there can be only one campaign of this name
    # first key is the CAMPAIGN_ID required by next method
    # (this ID is constant and should be cached for future use)
    
    $CAMPAIGN_ID = array_pop(array_keys($campaigns));
    
    $contact_id = array('p3WW','PEU'); // Find the contact ID by using email ID and form as array like this.
    
     $body   = "Newsletter message. we can send any HTML";
    
     # Sending Newsletter to the campaign
     $result = $client->send_newsletter(
    $api_key,
    array (
    
    
        "campaign"      => $CAMPAIGN_ID,
            "from_field"       => "<Find the From ID>", // To find it . Use this $accountDetails = $api->getAccountFromFields();
            "reply_to_field"   => "<Find the From ID>", // To find it . Use this $accountDetails = $api->getAccountFromFields();
            "subject"  => "Subject of the Newsletter",
            "name"     =>"Any Name",    
              "contacts"    => $contact_id,   
    
    'contents' => array(
     'html'       => $body 
     )
     )
    
     );
    
    
    
    
     ?>
    

    【讨论】:

    • 请解释一下你是如何工作的,我在这里看不到 send_newsletter 代码
    • 您必须创建时事通讯,然后在此处提供活动名称。你也可以在我的链接中找到一些很好的例子
    猜你喜欢
    • 2017-07-26
    • 2012-10-09
    • 2023-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-02
    • 2017-10-18
    • 1970-01-01
    相关资源
    最近更新 更多