%PDF- %PDF-
Direktori : /var/www/projetos/rrsos.com.br/libs/activecampaign/ |
Current File : /var/www/projetos/rrsos.com.br/libs/activecampaign/Subscriber.class.php |
<?php class AC_Subscriber extends ActiveCampaign { public $url; public $api_key; function __construct($url, $api_key) { $this->url = $url; $this->api_key = $api_key; } function add($params, $post_data) { $request_url = "{$this->url}&api_action=subscriber_add&api_output={$this->output}"; $response = $this->curl($request_url, $post_data); return $response; } function delete_list($params) { $request_url = "{$this->url}&api_action=subscriber_delete_list&api_output={$this->output}&{$params}"; $response = $this->curl($request_url); return $response; } function delete($params) { $request_url = "{$this->url}&api_action=subscriber_delete&api_output={$this->output}&{$params}"; $response = $this->curl($request_url); return $response; } function edit($params, $post_data) { $request_url = "{$this->url}&api_action=subscriber_edit&api_output={$this->output}&{$params}"; $response = $this->curl($request_url, $post_data); return $response; } function list_($params) { $request_url = "{$this->url}&api_action=subscriber_list&api_output={$this->output}&{$params}"; $response = $this->curl($request_url); return $response; } function paginator($params) { $request_url = "{$this->url}&api_action=subscriber_paginator&api_output={$this->output}&{$params}"; $response = $this->curl($request_url); return $response; } function sync($params) { $request_url = "{$this->url}&api_action=sync_run&api_output={$this->output}&{$params}"; $response = $this->curl($request_url); return $response; } function view($params) { // can be a subscriber ID, email, or hash if (preg_match("/^email=/", $params)) { $action = "subscriber_view_email"; } elseif (preg_match("/^hash=/", $params)) { $action = "subscriber_view_hash"; } elseif (preg_match("/^id=/", $params)) { $action = "subscriber_view"; } else { // default $action = "subscriber_view"; } $request_url = "{$this->url}&api_action={$action}&api_output={$this->output}&{$params}"; $response = $this->curl($request_url); return $response; } } ?>