function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
IDXNowTroyIDXNowTroy 

Web-to-Lead Automation Issue

We're trying to integrate the web-to-lead method within a client's website. Instead of having the user submit the form to send the information, we're trying to have a script (Perl) post the information as if it were the customer.

We're POSTing the information to http://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8. When I fill out the template HTML form and submit, I get a message saying that the request has been queued and I receive an email shortly after saying that the lead was created which I can confirm in the LEAD section. When I have a script post the exact same information, I get the exact same response from the server (including all of the correct information) saying that the request was queued but I don't receive the email and the lead is never created. We're currently running in sforce debug mode while we're developing this.

Is there some information required by the server that I'm not sending like the User Agent?

Any insights are greatly appreciated.

- Troy
IDXNowTroyIDXNowTroy
I had the below missing from my headers:

Content-Type: application/x-www-form-urlencoded
ygutierrezygutierrez
I have the same exact problem using the web to lead form code. After seeing your response, I added these two headers: content-type and user-agent. But it doesn't work. When I run the form typing the URL in a new browser (http://localhost/salesforce_form.aspx?sEmail=testyesi0721@testyesi.com) it works perfect (create the lead in SF), but when I run the form using (HttpWebRequest) WebRequest.Create(sCreateURL); it doesn't create the lead. This is my code
 
string sCreateURL = "http://localhost/salesforce_form.aspx?sEmail=testyesi0721@testyesi.com";

HttpWebRequest req = (HttpWebRequest) WebRequest.Create(sCreateURL);

req.ContentType = "application/x-www-form-urlencoded";

req.UserAgent = "Mozilla%2f4.0+(compatible%3b+MSIE+6.0%3b+Windows+NT+5.1%3b+SV1%3b+.NET+CLR+1.1.4322)";

HttpWebResponse res = (HttpWebResponse) req.GetResponse();

res.Close();

I will appreciate any help on this issue
Thank,
Yesenia