Drupal Technical
[Drupal] How to submit webform to an external application?
In one of my Drupal projects, I had a requirement to submit data from a webform to an external application. hook_webform_submission_insert() helps to meet my requirement. In your custom module, call the hook function hook_webform_submission_insert().
The below syntax will help you to implement and add your valuable code in each switch case.
/**
* Implement hook_webform_submission_insert().
* @param $node
* The Webform node on which this submission was made.
* @param $submission
* The Webform submission data, that was just inserted into the database.
*/
function my_module_webform_submission_insert($node, $submission){
$webform_id = $node->nid;
switch ($webform_id) {
case CONTACTUS_NODE_ID:
// Prepare data to be passed.
// Call to submit your data.
break;
}
}
Now, if you have any queries or doubts, please feel free to post your comments or contact us.