Created
February 15, 2022 15:13
-
-
Save MilenFrom/41ab0a66f85067419c5db7c5151298b4 to your computer and use it in GitHub Desktop.
PHP API Handler Acelle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Content-type: application/json'); | |
if( isset($_GET['list_uid']) && isset($_GET['api_token']) && isset($_GET['EMAIL']) ){ | |
$list_uid = $_GET['list_uid']; | |
$api_token = $_GET['api_token']; | |
$email = $_GET['EMAIL']; | |
$request_uri = $_SERVER['HTTP_REFERER']; | |
if($_SERVER['HTTP_ORIGIN'] == 'https://sofiaring.bg'){ | |
$post_url = 'https://email-marketing.sofiaring.bg'; | |
}elseif($_SERVER['HTTP_ORIGIN'] == 'https://bulgarcheta.com'){ | |
$post_url = 'https://buletin.bulgarcheta.com'; | |
}elseif($_SERVER['HTTP_ORIGIN'] == 'https://dplugins.com'){ | |
$post_url = 'https://sendmail.dplugins.com'; | |
} | |
send_acelle_data($post_url,$list_uid,$api_token,$email); | |
} | |
function send_acelle_data( $post_url, $list_uid, $api_token, $email ){ | |
$curl = curl_init(); | |
curl_setopt($curl, CURLOPT_POST, 1); | |
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); | |
$q_info = array( | |
'list_uid' => $list_uid, | |
'api_token' => $api_token, | |
'EMAIL' => $email | |
); | |
$post_query = $post_url.'/api/v1/subscribers?'.http_build_query($q_info, '', '&'); | |
curl_setopt($curl, CURLOPT_URL, $post_query); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); | |
$result = curl_exec($curl); | |
curl_close($curl); | |
echo $result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment