Buy Now
Sign in

FAQ search

How to post information from a Chronoform to ZoHo

Published: Monday, 30 November -0001 00:00

This FAQ is taken from a forum post by lowrykun.

I looked in the forum and didn't see a working example of how to post information from a Chronoform to ZoHo. I came up with a really simple way of doing it using the new Authentication Token.
On the OnSubmit Event add a Custom Code action.
//Get your auth code through the ZoHo
$auth = 'YOUR AUTH CODE';

// This is a very basic lead. 
// See
$xml = '<Leads>
<row no="1">
<FL val="Lead Source">Website</FL>
<FL val="First Name">'.$form->data['first_name'].'</FL>
<FL val="Last Name">'.$form->data['last_name'].'</FL>
<FL val="Email">'.$form->data['email'].'</FL>

//Initialize connection
$ch = curl_init('');
//standard i/o streams
curl_setopt($ch, CURLOPT_VERBOSE, 1);
// Turn off the server and peer verification
//Set to return data to string ($response)
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);//Regular post
//Set post fields
$query = "authtoken={$auth}&scope=crmapi&xmlData={$xml}";
// Set the request as a POST FIELD for curl.
curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
//Execute cUrl session
$response = curl_exec($ch);
That's it! With a valid token this should submit the contact's First Name, Last Name, Email, and Lead Source.

You could also build this with my {rokbox text=|cURL [GH] action| size=|1000,600| }{/rokbox} which allows you to set CURLOPTS