Hello all,
I have this form that I am trying to use to post data to an external url. I do have some very basic knowlegde of using php curl. So far if I use this code that I have written:
<?php
if ($_POST['request_callback'])
{
$customer_name = cleaninput($_REQUEST['customer_name'],"text");
$debtor_id = cleaninput($_REQUEST['debtor_id'],"number");
$telephone_number = cleaninput($_REQUEST['customer_number'],"number");
if ($_POST['callme_now'] == '1') {
$callback_time = date('y-m-d ' . $_POST['hour_select'] . ':' . $_POST['minute_select'] . ':s');
} else {
$callback_time = date('y-m-d H:i:s');
}
// Send using CURL
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, "http://www.myjoomla.eo/test.php"); // URL to post
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, "Name=$customer_name&Debtor_ID=$debtor_id&Telephone_Number=$telephone_number&CallBack_Time=$callback_time");
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec( $ch ); // runs the post
curl_close($ch);
echo "Reply Response: " . $result; // echo reply response
}
?>
So far, it does post to the file and the results are display. Now how do I format the data that has been posted into xml format? Ideally, I am trying to acheive something like this an xml that looks like this:
<?xml version="1.0" encoding="utf-8"?>
<CallRequest>
<ProjectName>Test</ProjectName>
<ContactNumberToDial>07843088348</ContactNumberToDial>
<DateTimeToDial></DateTimeToDial>
<ListSource>WebLead</ListSource>
<AgentName></AgentName>
<AddToList>False</AddToList>
<SpecificAgent>False</SpecificAgent>
<DBField>
<FieldName>Name</FieldName>
<FieldValue>Testing</FieldValue>
</DBField>
</CallRequest>
Anyone have an Idea of what to do here?
Thanks,
James