Can anyone tell me how to post to webservices from ChronoForms? I need to post an XML document - it is the only API provided by Feedblitz.
Thanks,
D.
Thanks,
D.
The full data to post in a HTTP "POST" operation. To post a file, prepend a filename with @ and use the full path. This can either be passed as a urlencoded string like 'para1=val1ΒΆ2=val2&...' or as an array with the field name as key and field data as value. If value is an array, the Content-Type header will be set to multipart/form-data.
$query = JURI::buildQuery($curl_values);
$messages[] = '<b>cf_CURL debug info</b>';
$messages[] = '$curl_values: '.print_r($query, true);
$messages[] = '$params->target_url: '.print_r($params->get('target_url'), true);
$ch = curl_init($params->get('target_url'));
$messages[] = '$ch: '.print_r($ch, true);
curl_setopt($ch, CURLOPT_HEADER, $params->get('header_in_response')); // set to 0 to eliminate header info from response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
curl_setopt($ch, CURLOPT_POSTFIELDS, $query); // use HTTP POST to send form data
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$response = curl_exec($ch); //execute post and get results
curl_close ($ch);
It woudl probably be easy to add the extra line.