Hope someone can assist as I am banging my head against a wall.
We have a SOAP API configured that when triggered using this code
add_action('gform_post_submission', 'post_to_third_party', 10, 2);
function post_to_third_party( $entry, $form) {
$client = new SoapClient('http://test.com/wslib.asmx?wsdl');
$add_client_payload = array(
"ctcmiddlename" => "abc",
"ctcjobtitle" => "abc",
"ctclastname" => "abc",
"ctcAddress1" => "abc",
"ctcAddress2" => "abc",
"ctcAddress3" => "",
"ctccity" => "abc",
);
$add_client_response = $client->AddClientKYC($add_client_payload);
}
And this works perfectly. Using the 'gform_post_submission' as opposed to 'gform_after_submission' as the after submission creates a 500 error. Once completing the form, the code triggers from the functions.php file and loads to an external database with the hard coded values in the array.
BUT... when I try map the Gravity Forms fields into the array the code gets to my array and stops and doesn't load to the server.
I have tried the following methods and none seem to work.
$add_client_payload = array(
"ctcfirstname" => rgar( $entry, '89.3' ),
"ctcmiddlename" => rgar( $entry, '89.4' ),
"ctcjobtitle" => rgar( $entry, '201' ),
"ctclastname" => rgar( $entry, '89.6' ),
Also
"ctcfirstname" => $entry['89.3'],
"ctcmiddlename" => $entry['89.4'],
"ctcjobtitle" => $entry['201'],
"ctclastname" => $entry['89.6'],
Seriously at a loss, can someone help?
There is no problem with the call and post to the 3rd party, just getting the right way to pull in the fields from the form.
Thanks in advance!