Forums

how to integrate getresponse?

lucchini_silvio 25 Dec, 2015
Hi,
I must integrate chronoform with getresponse,
what is the easiest way?

curl or php?

There is a tutorial or sample code?
thanks for your answers
GreyHead 26 Dec, 2015
Hi luccini_silvio,

I've never heard of GetResponse but I found an API here that will almost certainly work with ChronoForms.

Bob
lucchini_silvio 26 Dec, 2015
1 Likes
Hello Bob,
thanks for the reply.
I just solved with this php code


<?php
# Demonstrates how to add new contact 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 = '---------------------------------------------------';

# 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' => '------------------------------' )
    )
);

# uncomment following line to preview Response
# print("$campaigns\n");

# print_r($campaigns);

# print("\n");

# 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));

# add contact to the campaign
try {
$result = $client->add_contact(
    $api_key,
    array (
        # identifier of 'test' campaign
        'campaign'  => $CAMPAIGN_ID,

        # basic info
        'name'      => $form->data['nomecognome'],
        'email'     => $form->data['email'],
        'cycle_day' => 0
    )
);
}
catch (Exception $e) {
    # check for communication and response errors
    # implement handling if needed
    # die($e->getMessage());
}

# uncomment following line to preview Response
# print("$result\n");
# print_r($result);
# print("\n");

# print("Contact added\n");

# Pawel Pabian http://implix.com

?>


Silvio
This topic is locked and no more replies can be posted.