You need to sign in to do that
Don't have an account?

performing a POST via ASP to Web2Lead...
Hello. I'm trying to submit a lead via Web2Lead - but programatically. Below is the essence of the code. It isn't working. I don't see any errors, but no lead is created and I don't get the resulting email. If I create an HTML form and try it, it works perfectly.
I'm doing this programatically because I want to do multiple things with the info. Send some emails, create a Lead, etc...
Thanks for your time.
Chris
Set objHttp = Server.CreateObject("Microsoft.XMLHTTP")
objHttp.Open "POST", "http://www.salesforce.com/servlet/servlet.WebToLead", False
QS = "debug=0"
QS = QS & "&encoding=UTF-8"
QS = QS & "&oid=my oid here"
QS = QS & "&debugEmail=my email addr here"
QS = QS & "&first_name=TEST"
QS = QS & "&last_name=TEST"
objHttp.Send QS
strResult = objHttp.responseText
Set objHttp = Nothing
response.write("[" & QS & "]<br>")
response.write("[" & strResult & "]<br>")
response.end
I'm doing this programatically because I want to do multiple things with the info. Send some emails, create a Lead, etc...
Thanks for your time.
Chris
Set objHttp = Server.CreateObject("Microsoft.XMLHTTP")
objHttp.Open "POST", "http://www.salesforce.com/servlet/servlet.WebToLead", False
QS = "debug=0"
QS = QS & "&encoding=UTF-8"
QS = QS & "&oid=my oid here"
QS = QS & "&debugEmail=my email addr here"
QS = QS & "&first_name=TEST"
QS = QS & "&last_name=TEST"
objHttp.Send QS
strResult = objHttp.responseText
Set objHttp = Nothing
response.write("[" & QS & "]<br>")
response.write("[" & strResult & "]<br>")
response.end
Hi Chris,
I assume you are talking about classic asp and not dot net as you could use HttpWebRequest instead. Try the following
Dim objHttp
Response.Buffer = True
strUrl = "http://www.salesforce.com/servlet/servlet.WebToLead"
QS = "debug=0"
QS = QS & "&encoding=UTF-8"
QS = QS & "&oid=my oid here"
QS = QS & "&debugEmail=my email addr here"
QS = QS & "&first_name=TEST"
QS = QS & "&last_name=TEST"
Set objHttp = Server.CreateObject("Microsoft.XMLHTTP")
objHttp.Open "POST",strURL, False
objHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objHttp.Send QS
strResult = objHttp.responseText
Set objHttp = Nothing
response.write("[" & QS & "]<br>")
response.write("[" & strResult & "]<br>")
response.end
Chris
thanks
chris
Go to Setup > Customize > Leads > Web 2 Lead > Generate > Select all the fields and click the Generate button it'll give you the html form with all the ids and names set
:)
Hope it helps.