Let's imagine the following situation:
You have a simple php page with an html form that allows the user to enter the following data:
- Phone Number
- Text Message
Such as:
<form action="xml-file.xml" method="get">
<input type="text" id="to" name="to" value="" />
<input type="text" id="text" name="text" value="" />
<input type="submit" />
</form>
Now, you create an XML using this method that I've tested and works without a problem, and afterwards you want to send it via URL using this other method (CURL).
Unfortunately, I can't reach the CURL method, as I can't link the submit action to both create the XML and send it to an URL so it goes to a local server (www.example.xxx:1234) and afterwards processes that XML for sending an SMS.
That server sends a response if the format of the XML is the right one. My issue is, therefore, on the submission of the created XML.
Help?
Update 1: Adding the updated code. This allows me (with a chmod 777 onto the sms.xml file) to edit the xml file at will.
index.php
<html>
...
<form action="send.php" method="get">
<input type="text" id="to" name="to" value="" />
<input type="text" id="text" name="text" value="" />
<input type="submit">
</form>
...
</html>
send.php
<?php
$xml = simplexml_load_file("sms.xml"); // Load XML file
$xml->Title3 = $_GET['to']; // Updating <Title3> from GET method
$xml->Title5[0]->Title51Content = $_GET['text']; // Updating <Title51> from GET method
$xml->asXML('sms.xml'); // Saving the XML file
?>
sms.xml
<?xml version="1.0" encoding="UTF-8"?>
<Title1>
<Title2>Some Text</Title2>
<Title3>Variable 1</Title3>
<Title4>Some Text</Title4>
<Title5>
<Title51>Variable 2</Title51>
</Title5>
</Title1>
Side note: XML should have, when sending, the "Content-Type","application/x-www-form-urlencoded" header for returning something like this:
XML=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%0A%3...
Thanks!