I'm struggling with getting remote post response data to print on the Gravity Forms confirmation page. The data from the form is posted to the 3rd party site successfully and my logs show that the response data is received, however the received data is not printing to the confirmation page.
I have tried many variations such as;
$request = new WP_Http();
$data = json_decode( wp_remote_retrieve_body( $response ) );
$response = wp_remote_post( $post_url, array( 'body' => $body ) );
GFCommon::log_debug( 'gform_confirmation: response => ' . print_r( $response, true ) );
return $confirmation;
I submit the data via a plugin and have tried with the filters gform_confirmation, gform_after_submission, and gform_entry_post_save to no avail.
After many support tickets to Gravity Forms; I'm told that to do this requires additional scripting.
Thank you, Richard
This is the code I have so far for the plugin.
add_filter( 'gform_confirmation_2', 'custom_confirmation', 10, 4 );
function custom_confirmation( $confirmation, $form, $entry, $ajax ) {
$post_url = 'my_post_url';
$body = array(
'VTC_ID' => rgar( $entry, '15' ),
'Member_ID' => rgar( $entry, '16' ),
'bname' => rgar( $entry, '3' ),
'baddress' => rgar( $entry, '4' ),
'bcity' => rgar( $entry, '5' ),
'bstate' => rgar( $entry, '6' ),
'bcountry' => rgar( $entry, '7' ),
'bzip' => rgar( $entry, '8' ),
'phone' => rgar( $entry, '9' ),
'email' => rgar( $entry, '17' ),
'password' => rgar( $entry, '11' ),
'isTrial' => rgar( $entry, '12' ),
'isActive' => rgar( $entry, '18' ),
'trialStart' => rgar( $entry, '13' ),
'trialEnd' => rgar( $entry, '14' ),
);
GFCommon::log_debug( 'gform_confirmation: body => ' . print_r( $body, true ) );
$request = new WP_Http();
$response = wp_remote_post( $post_url, $parameters );
$confirmation .= print_r( $response, true );
return $confirmation;
GFCommon::log_debug( 'gform_confirmation: response => ' . print_r( $response, true ) );
}