OK...I was able to use a form in HTML/PHP to add a record to one of my Creator Forms...and I posted this solution here...
So now I want to emulate this by a PHP command line call...and I've done some research...I think quite a number of people are disappointed that there isn't PHP example source code for this feature available...I've looked at the Java code...and can't figure out what needs to be done...I will provide the following attempt...but as yet I haven't got it working...
The core of this problem is 'How do I prepare a params array with the 2 key pieces of data that I want to pass to the Creator form - a) the XMLString data and b) zc_ownername.....
Appreciate any help with this...
- <?php
- $data = "<ZohoCreator><applicationlist><application name=\"sfit-email-templates\"><formlist><form name=\"Post_Method_Receiver_Test\"><add><field name=\"Task\"><value>liamsTest</value></field><field name=\"Description\"><value>liamsTestDescr</value></field></add></form></formlist></application></applicationlist></ZohoCreator>";
- //Need to sort our XMLString and zc_ownername....where do they go!!!
- //
- // Some form of nested array to pack in the params in a map-like
- // collection....
- $params = array('http' => array(
- 'method' => 'POST',
- 'content' => array(
- 'XMLString' => $data,
- 'zc_ownername' => 'liamzoho2'
- )));
- $url = "http://creator.zoho.com/api/xml/write/apikey=953452e0a3444591a4b4bd3333&ticket=87b222229102f4c6059a139a7266e7112";
- echo "params is : ";
- var_dump($params);
- echo "the URL is $url";
- $ctx = stream_context_create($params);
- $fp = @fopen($url, 'rb', false, $ctx);
- if (!$fp) {
- throw new Exception("Problem with $url, $php_errormsg");
- }
- $response = @stream_get_contents($fp);
- if ($response === false) {
- throw new Exception("Problem reading data from $url, $php_errormsg");
- }
- echo $response;
- ?>
Thanks,
Liam.