Problem sending WebToLead Form per cURL
Hi,
till 1 or 2 months ago, I was sending a WebToLead Form on a Website to an intermediate PHP Script to intercept the data and use it for other means first and then send it to Zoho per cURL. And it was working fine.
Then it stopped working, I was receiving a 302 Status Code and Zoho was redirecting the request from
https://crm.zoho.com/crm/WebToLeadForm to
http://www.zoho.com
Strange enough, on my local server exactly the same code is working and on the live server not, so I guess there is a new filter in Zoho blocking specific requests. I have tried different cURL options, but as long as I can see through debugging I'm sending exactly the same request on both local and live server (both PHP 5.6 too).
Why I'm not sending it through API? Cause the leads have to land on approval, and there is no possibility to activate a workflow alert on approval with the API, so we have to use a WebToLead Notification.
Here is my code:
$postfields = http_build_query($data); //equals in most part $_POST, after validating $_POST
curl_setopt($zoho, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($zoho, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($zoho, CURLOPT_POST, 1);
curl_setopt($zoho, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($zoho, CURLOPT_POSTFIELDS, $postfields);
$response = curl_exec($zoho);
$code = curl_getinfo($zoho,CURLINFO_HTTP_CODE);
echo $code; //outputs 302
$result_zoho = ($response !== false && $code < 300) ? true : false;
Maybe someone has a clue? Thanks!