function addUserPardot($email, $api) { $api = trim(strip_tags($api)); $response = callPardotApi('https://pi.pardot.com/api/prospect/version/3/do/create/email/' . $email, array('api_key' => $api, 'user_key' => '716f7eaef2cf741e472ab651c479fd4d'), 'POST'); return XMLtoPHPArray($response); }
function addSubscription() { // Error string for aleady exist, may use in the future #A prospect with the specified email address already exists // If not registration if (isset($_POST['email'])) { $email = $_POST['email']; // This will log in and print your API Key (good for 1 hour) to the console $api = callPardotApi('https://pi.pardot.com/api/login/version/3', array('email' => '*****@*****.**', 'password' => 'Wurlitzer77!', 'user_key' => '716f7eaef2cf741e472ab651c479fd4d')); $result = addUserPardot($email, $api); } $status = $result['@attributes']['stat']; if ($status == 'fail') { $message['copy'] = $result['err']; } else { if ($status == 'ok') { $message['copy'] = 'You have been successfully added.'; } } $message['result'] = $status; echo json_encode($message); exit; }