Skip to content

Instantly share code, notes, and snippets.

@aldidas
Created June 19, 2017 05:53
Show Gist options
  • Save aldidas/cde86efc7c2c50d5e101e8b9055ea42a to your computer and use it in GitHub Desktop.
Save aldidas/cde86efc7c2c50d5e101e8b9055ea42a to your computer and use it in GitHub Desktop.
/**
$posted_data = PHP array consisting posted data from the form :
$posted_data = array(
'message' => '',
'fullname' => '',
'company' => '',
'position' => '',
'telephone' => '',
'email' => ''
);
*/
$action_url = 'https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8';
$formdata = 'lead_source=Web-ID&Campaign_ID=7015F000000hgGK&description='. $posted_data['message'] .'&last_name='. $posted_data['fullname'] .'&first_name=&company='. $posted_data['company'] .'&title='. $posted_data['position'] .'&phone='. $posted_data['telephone'] .'&email=' . $posted_data['email'];
$ch = curl_init($action_url);
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $formdata);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
curl_exec( $ch );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment