Once you forward the user after a successful submission, your form data is lost. You can intercept the form data processing in WP by hooking into the before_send_mail action hook provided by CF7. This allows you to access the form data on the server, preprocess it if necessary, and then POST the data to your custom processor script.
// Create the new wordpress action hook before sending the email from CF7
add_action( 'wpcf7_before_send_mail', 'my_conversion' );
function my_conversion( $contact_form ) {
$submission = WPCF7_Submission::get_instance();
// Get the post data and other post meta values.
if ( $submission ) {
$posted_data = $submission->get_posted_data();
// these variables are examples of other things you may want to pass to your custom handler
$remote_ip = $submission->get_meta( 'remote_ip' );
$url = $submission->get_meta( 'url' );
$timestamp = gmdate("Y-m-d H:i:s", $submission->get_meta( 'timestamp' ));
$title = wpcf7_special_mail_tag( '', '_post_title', '' );
// If you have checkboxes or other multi-select fields, make sure you convert the values to a string
$mycheckbox1 = implode(", ", $posted_data["checkbox-465"]);
$mycheckbox2 = implode(", ", $posted_data["checkbox-466"]);
// Encode the data in a new array in JSON format
$data = json_encode(array(
"posted_key_name_1" => "{$posted_data["input-name-1"]}",
"posted_key_name_2" => "{$posted_data["input-name-2"]}",
"posted_key_name_..." => "{$posted_data["input-name-..."]}",
"posted_key_name_n" => "{$posted_data["input-name-n"]}",
// any additional data to include that wasn't part of the form post?
"From URL" => "$url",
"From IP" => "$remote_ip",
"Page Title" => "$title"
));
// Finally send the data to your custom endpoint
$ch = curl_init("https://www.YOURDOMAIN.com/custom.php");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,5); //Optional timeout value
curl_setopt($ch, CURLOPT_TIMEOUT, 5); //Optional timeout value
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
}
}
This will post the selected form data to your custom processor right before CF7 processes the form and sends the confirmation mail. You'll still want to make sure the user experience is satisfactory by either displaying the CF7 confirmation message that the form has been submitted, or forwarding the user to a thank you page using the JS redirect -> on_sent_ok: https://yourdomain.com/thanks/
If it is necessary that the user visits your custom processor page because the processor page generates information important to the user, you could package up all the form data into a URL string and append that onto the processing URL. Then, in your processing.php code, you'd use $_GET[] to access the data.
See this article for details on how to dynamically update set the redirect URL: How to change contact form 7 Redirecting URL dynamically - WordPress
Submitting data to a webhook code from this page: http://moometric.com/integrations/wp/contact-form-7-zapier-webhook-json-post/