AnsweredAssumed Answered

SugarCRM 6.5.16 CE: Duplicate Leads w/ Web to Lead Submission using CURL

Question asked by community-support on Jan 13, 2014
Latest reply on Aug 18, 2014 by Anil Purushothaman
Dear SugarCRM Community,

To collect leads from our landing pages, we're using customized forms where the lead is then submitted to SugarCRM via CURL (index.php?entryPoint=WebToLeadCapture).  So far this works great with the exception that the submissions are not checked for duplicate entries.  E.g if someone clicks twice on the form's submission button the lead is entered twice with two unique ids.  Is there any hidden field we need to include for the duplication check to work?  The only thing I've found so far is the field dup_checked = 1 but this will actually allow the entry of duplicate leads.

This is the code I am using:


//Get values of form fields

$salutation=implode(', ',$_POST['form']['Salutation']);





$primary_address_country=implode(', ',$_POST['form']['CountryCode']);

$lead_source_description ''; //Lead Source Description


$campaign_id=''; //Campaign ID

$assigned_user_id=''; //Assigned User ID



//Prepare $PostFields array to send to SugarCRM using CURL















//Send data to SugarCRM

$ch = curl_init('https://sugarcrmurl/index.php?entryPo...'); //SugarCRM URL

curl_setopt($ch, CURLOPT_TIMEOUT, 5);  //5 seconds timeout

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //Do not verify SSL certificate

curl_setopt($ch, CURLOPT_POST, true);

curl_setopt($ch, CURLOPT_POSTFIELDS, $PostFields);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_FAILONERROR,true);  //This is required for CURL to report 400 errors


//Check for CURL submission errors

if(curl_errno($ch)) {

  //Error notifications go here


else {

  //Submission was successful, close CURL Handle

  curl_close ($ch);



Any hints are highly appreciated!

Kind regards,


(from sconsulting)