Hi, can anybody help for my case, I used multi page form and use gform_after_submission action to send out the form to other process here’s the code that I’ve write for this function
add_action('gform_after_submission_2', 'send_to_otherproceed', 10, 2);
function send_to_otherproceed($entry, $form) {
$data = [
'type' => 'leader',
'leadSource' => 'HDD52',
'Height' => rgar($entry, '5'),
'Weight' => rgar($entry, '7'),
'Income' => rgar($entry, '6'),
'gender' => rgar($entry, '10'),
'birthDate' => rgar($entry, '14'),
'street1' => rgar($entry, '23'),
'city' => rgar($entry, '26'),
'stateAbbrev' => rgar($entry, '27'),
'zip' => rgar($entry, '45'),
'title' => 'Mr.', // adjust this as needed
'firstName' => rgar($entry, '17.3'),
'lastName' => rgar($entry, '17.6'),
'email' => rgar($entry, '18'),
'businessPhone' => rgar($entry, '46'),
'SMSOptIn' => rgar($entry, '29'),
'leadDate' => date('m/d/Y') // Today's date in MM/DD/YYYY format
];
$url = 'https://app.otherprocess.net/fp/YTU9I98TKUQV81AXY98/contact/create';
$headers = [
'Content-Type' => 'application/x-www-form-urlencoded'
];
$args = [
'body' => http_build_query($data),
'headers' => $headers,
'method' => 'POST'
];
$response = wp_remote_post($url, $args);
if (is_wp_error($response)) {
error_log('Request error: ' . $response->get_error_message());
} else {
$status_code = wp_remote_retrieve_response_code($response);
$body = wp_remote_retrieve_body($response);
error_log("Response status code: " . $status_code);
error_log("Response body: " . $body);
}
}
the wordpress log report 200 and success also try with postman return with 200ok but looks like the data is not coming on the other data list