Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $smartresponder_delid = '000000'; // ID рассылки
- $smartresponder_api_url = 'http://api.smartresponder.ru/subscribers.html'; // URL API для добавления подписчиков
- $debug = 0; // включить отладку?
- $API_KEY = 'FAFAFAAFAFFA'; // Smartresponder API KEY
- if ($debug==1) {
- ob_start();
- print_r($_POST);
- $out = ob_get_contents();
- file_put_contents('tmp.txt',$out, FILE_APPEND);
- ob_end_clean();
- }
- function goit($url,$post){
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- $out = curl_exec($ch);
- curl_close($ch);
- return $out;
- }
- if (isset($_POST['data'])) {
- $name = $_POST['data']['client']['name'];
- $email = $_POST['data']['client']['email'];
- $smresp_post_data = array(
- 'api_key'=>$API_KEY,
- 'format'=>'json',
- 'action'=>'create',
- 'delivery_id'=>$smartresponder_delid,
- 'email'=>$email,
- 'first_name'=>$name,
- );
- $res = goit($smartresponder_api_url,$smresp_post_data);
- if ($debug==1) {
- ob_start();
- print_r($res);
- $out = ob_get_contents();
- file_put_contents('tmp.txt',$out, FILE_APPEND);
- ob_end_clean();
- }
- } else {
- exit();
- }
- exit();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment