Webform + Salesforce Submission Integration

This code goes in the Additional Processing section of a Webform.
You must also ensure that your Component Field Keys match the fields from your Salesforce database.

Snippet:

$url = 'https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8';
$headers = array('Content-Type' => 'application/x-www-form-urlencoded; charset=UTF-8');
$data = http_build_query($form_state['values']['submitted_tree'], '', '&');
$req = drupal_http_request($url, $headers, 'POST', $data);

Comments