Answer the question
In order to leave comments, you need to log in
SendPulse API: how to integrate in Contact Form 7?
The task of integration is set. I am not very friendly with php, I did it based on an example.
Who had experience of such integration, please tell me why this code does not work.
cf7-sendpulse.php file code
<?php
/* ----------------------------------------------------------------------------
* Integration SendPulse to Contact form 7
* ---------------------------------------------------------------------------- */
require("sendpulse-library/sendpulse-rest-api-php/src/ApiInterface.php");
require("sendpulse-library/sendpulse-rest-api-php/src/ApiClient.php");
require("sendpulse-library/sendpulse-rest-api-php/src/Storage/TokenStorageInterface.php");
require("sendpulse-library/sendpulse-rest-api-php/src/Storage/FileStorage.php");
require("sendpulse-library/sendpulse-rest-api-php/src/Storage/SessionStorage.php");
require("sendpulse-library/sendpulse-rest-api-php/src/Storage/MemcachedStorage.php");
require("sendpulse-library/sendpulse-rest-api-php/src/Storage/MemcacheStorage.php");
function add_email_to_sendpulse($contact_form) {
$wpcf7 = WPCF7_ContactForm::get_current();
$submission = WPCF7_Submission::get_instance();
$data = $submission->get_posted_data();
$book_id = 1717359;
$email = $data['Email'];
if ($cur_email != '') {
define( 'API_USER_ID', '*******' );
define( 'API_SECRET', '*******' );
define( 'TOKEN_STORAGE', 'sendpulse-library/sendpulse-rest-api-php/src/Storage/token.txt' );
$SPApiProxy = new SendpulseApi( API_USER_ID, API_SECRET, TOKEN_STORAGE );
$SPApiProxy->addEmails($book_id, array($email) );
}
}
?>
require_once('cf7-sendpulse.php');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question