Using CURL to submit to Web-to-Contact forms
We are trying to integrate our existing lead-capture forms with Zoho's web-to-contact functionality to automatically create Zoho contacts whenever someone submits to our forms. We are using the following code:
<?php
$zohovals = array();
$zohovals['xnQsjsdp'] = "xxxxxxxxx";
$zohovals['xmIwtLD'] = "xxxxxxxxxx";
$zohovals['actionType'] = "xxxxxxxxxx";
$zohovals['returnURL'] = "http://www.oursite.com/thank-you";
$zohovals['First Name'] = $form_values['submitted_tree']['first_name'];
$zohovals['Last Name'] = $form_values['submitted_tree']['last_name'];
$zohovals['Email'] = $form_values['submitted_tree']['email'];
$zohovals['Phone'] = $form_values['submitted_tree']['phone_number'];
$zohovals['Company'] = $form_values['submitted_tree']['company'];
$zohovals['Description'] = "x";
$zohovals['save'] = "Save";
$url = "http://crm.zoho.com/crm/WebToContact";
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $zohovals);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
?>
$form_values stores the form's submitted data.
The form submits fine but no contact is created in Zoho. This code has worked for us before (iContact forms). The raw form html given to us from Zoho works and creates contacts fine, and the $_POST variables submitted through both methods (CURL and straight up html post submissions) are identical...
Any help would be appreciated.