How to read the data after the "?" (e.g. index.php?x=off) ?
Posted: Tue Jan 06, 2009 5:53 pm
I've got a very simple script to chage a value on a XML file, that will be later read by a Visual Basic program. I got everything working, but i want to optimize.
Let's give an example of the code:
Let´s say i want those variables: "X,Y,Z" to change based on what you see after the "?" before the webpage url. (e.g. http://server.com/thing.php?x=0&y=Off&z=state)
How is it done?
Any ideas? examples?
Thanks! =D
PS.- Sorry! I didn't noticed the PHP - Code Section... xD
Let's give an example of the code:
Code: Select all
<?php
if (file_exists('1.xml')) {
$xml = simplexml_load_file('1.xml');
} else {
exit('Error al abrir test.xml.');
}
[b] [size=200]$xml->z[x] = 'y'; [/size][/b]
echo $xml->asXML();
$xml->saveXML('1.xml'); // save as file
?>How is it done?
Any ideas? examples?
Thanks! =D
PS.- Sorry! I didn't noticed the PHP - Code Section... xD