-
-
Save cdsaenz/51d34ebdbacf0186467f9988426ef975 to your computer and use it in GitHub Desktop.
Using Pardot and Formidable
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 | |
add_action('frm_after_create_entry', 'sendToPardotFormHandler', 30, 2); | |
function sendToPardotFormHandler($entry_id, $form_id){ | |
if($form_id == 3){ //replace 3 with the id of the form | |
$args = array(); | |
if(isset($_POST['item_meta'][XX])) //change XX to the field ID | |
$args['firstName'] = $_POST['item_meta'][XX]; //change 'firstName' to the named parameter to send | |
if(isset($_POST['item_meta'][XX])) //change XX to the field ID | |
$args['lastName'] = $_POST['item_meta'][XX]; //change 'lastName' to whatever you need | |
if(isset($_POST['item_meta'][XX])) //change XX to the field ID | |
$args['email'] = $_POST['item_meta'][XX]; //change 'email' to whatever you need | |
if(isset($_POST['item_meta'][XX])) //change XX to the field ID | |
$args['phone'] = $_POST['item_meta'][XX]; //change 'phone' to whatever you need | |
$result = wp_remote_post('https://example.com', array('body' => $args)); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment