I have to send an XML request to recover data from a remote server and parse it using PHP. That much, I've managed to do... sort of. The trouble is, the XML I get back from the remote server looks something like this:
<info user="user" password="password" session="session">
<data value="8" />
<data date="..." />
If someone were to look at the source code on my website, they would see all of the above code including the sensitive username and password data included in the first tag, is there any way I can hide this?
Here is the code I use to recover and parse the data:
<?php
$url = 'http://www.whereigetmyxml.com';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
$xml = simplexml_load_file($url);
$myData = $xml->data[1]['date'];
echo $myData;
?>
Thanks!