title: Post form data to external url + curl
body: <p>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:</p>
  
  <pre><code>&lt;?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&amp;Debtor_ID=$debtor_id&amp;Telephone_Number=$telephone_number&amp;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
       }
  ?&gt;
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;CallRequest&gt;
  &lt;ProjectName&gt;Test&lt;/ProjectName&gt;
  &lt;ContactNumberToDial&gt;07843088348&lt;/ContactNumberToDial&gt;
  &lt;DateTimeToDial&gt;&lt;/DateTimeToDial&gt;
  &lt;ListSource&gt;WebLead&lt;/ListSource&gt;
  &lt;AgentName&gt;&lt;/AgentName&gt;
  &lt;AddToList&gt;False&lt;/AddToList&gt;
  &lt;SpecificAgent&gt;False&lt;/SpecificAgent&gt;
  &lt;DBField&gt;
      &lt;FieldName&gt;Name&lt;/FieldName&gt;
      &lt;FieldValue&gt;Testing&lt;/FieldValue&gt;
  &lt;/DBField&gt;
  &lt;/CallRequest&gt;
  </code></pre>
  
  <p>Anyone have an Idea of what to do here?</p>
  
  <p>Thanks,</p>
  
  <p>James</p>