I am creating a web lead by doing a curl like so
//set POST variables
$url = 'https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8';
$fields = array(
'last_name'=>urlencode($ch_register_last_name),
'first_name'=>urlencode($ch_register_first_name),
'street'=>urlencode($ch_register_street),
'city'=>urlencode($ch_register_city),
'state'=>urlencode($ch_register_state),
'zip'=>urlencode($ch_register_zip),
'description'=>urlencode($ch_register_event_city),
'email'=>urlencode($ch_register_email),
'phone'=>urlencode($ch_register_phone),
'Event_City__c' => urlencode($ch_register_event_city), // custom fields
'Register_DOB__c' => urlencode($ch_register_dob),
'Register_Emergency_Contact__c' => urlencode($ch_register_emergency_name),
'Register_Emergency_Phone__c' => urlencode($ch_register_emergency_phone),
'Register_Release__c' => urlencode($ch_register_agree),
'No_Text__c' => urlencode($ch_register_no_text),
'Under_18__c' => urlencode($ch_register_under_age),
'Volunteer_Option__c' => urlencode($ch_register_volunteer_option),
'Register_Release_Name__c' => urlencode($ch_register_signiture),
'Register_Release_Date__c' => urlencode($ch_register_signiture_date),
'lead_source' => 'Outreach Volunteer',
'oid' => $ch_register_salesforce_id, // insert with your id
'retURL' => urlencode('thank-you/'), // sending this just in case
'debug' => '0',
'debugEmail' => urlencode(""), // your debugging email
);
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION, TRUE);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
Is there any way to get the ID of the lead created in a response??? I need the ID after this lead is created for another part of the code (send that lead an Adobe echoSign agreement). And unfortunately the only way to connect the two in SF is this way, I can't just send the form to the email or else they live separately in SF.
Thanks! Any option would be great. I dont have to use the web-lead way if there is a better way from their API. Just need the ID in a response. I just feel like its possible since when I have debug on I get an email with the ID in the email