Created
August 14, 2014 20:13
-
-
Save atwellpub/109d5090d8cbf9b18642 to your computer and use it in GitHub Desktop.
Example of how to hook into inboundnow_form_submit_actions
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 | |
/** | |
* inboundnow_form_submit_actions after form validationa and before user redirection. | |
*/ | |
add_action('inboundnow_form_submit_actions','extension_send_data' , 10 , 2 ); | |
/** | |
* This method will perform additional actions during the inboundnow_form_submit_actions hook | |
* | |
* @param ARRAY $form_post_data contains all the field/value data of a submitted inbound form | |
* @param ARRAY @form_meta_data contains meta data related to an inbound form. | |
*/ | |
function extension_send_data( $form_post_data , $form_meta_data ) | |
{ | |
/* URL we want to send the data to */ | |
$external_url = "http://www.remoteservice.com/api/"; | |
/* Uncomment these lines to peak at what is inside*/ | |
//print_r( $form_post_data , true ) ; exit; | |
//print_r( $form_meta_data , true ) ; exit; | |
$response = wp_remote_post( $external_url , array( | |
'method' => 'POST', | |
'timeout' => 20, | |
'redirection' => 5, | |
'httpversion' => '1.0', | |
'blocking' => true, | |
'headers' => array( | |
'Content-Type' => 'application/json', | |
), | |
'cookies' => array(), | |
'body' => json_encode($form_post_data) | |
) | |
); | |
/* Uncomment this line to print the 3rd party response */ | |
//print_r( $response , true ) ; exit; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment