Skip to content

Instantly share code, notes, and snippets.

@lancegliser
Last active November 19, 2015 22:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lancegliser/980cc34b3289891e6cc2 to your computer and use it in GitHub Desktop.
Save lancegliser/980cc34b3289891e6cc2 to your computer and use it in GitHub Desktop.
Using the emfluence marketing platform php api library
<?php
$api = new Emfl_Platform_API($api_key);
$data = array();
$data['groupIDs'] = !empty($_POST['groups'])? $_POST['groups'] : '';
$data['originalSource'] = trim( $_POST['source'] );
$data['firstName'] = !empty( $_POST['first_name'] )? trim( $_POST['first_name'] ) : '';
$data['lastName'] = !empty( $_POST['last_name'] )? trim( $_POST['last_name'] ) : '';
$data['title'] = !empty( $_POST['title'] )? trim( $_POST['title'] ) : '';
$data['company'] = !empty( $_POST['company'] )? trim( $_POST['company'] ) : '';
// $data['phone'] = trim( $form_data['phone_number'] );
$data['email'] = trim( $_POST['email'] );
$data['customFields'] = array();
$data['customFields']['custom1'] = !empty( $_POST['custom_1'] )? array('value' => trim( $_POST['custom_1'] ) ) : '';
$result = $api->contacts_save($data);
if( !$result->success ){
$success = FALSE;
$messages[] = array('type' => 'error', 'value' => __('An error occurred contacting the email service.'));
} else {
$success = TRUE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment