Информационный бюллетень Getresponse API не работает

Я попытался отправить информационный бюллетень getresponse через API. Это не работает, как ожидалось. я следил за https://github.com/GetResponse/DevZone/tree/master/API#send_newsletter

Здесь код http://pastebin.com/tWWKgpF5

Я не уверен, что неправильно.


person Rockstar    schedule 10.06.2014    source источник


Ответы (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 
 )
 )

 );




 ?>
person Rockstar    schedule 28.06.2014
comment
пожалуйста, объясните, как у вас это работает, я не вижу здесь код send_newsletter - person Zulqurnain abbas; 06.07.2015
comment
Вы должны создать информационный бюллетень, а затем указать здесь название кампании. Вы также можете найти несколько хороших примеров в моих ссылках - person Rockstar; 22.07.2015