Greetings Everybody & thanks in advance for your answers. So, my difficulty is this, i found a nice tutorial about a restful web service and i can not manage to modify it to my needs.
The below sample code works like a charm
function get_price($find) {
$products = array(
"test" => 293,
"test2" => 348,
"test3" => 267
);
foreach ($products as $product => $price) {
if ($product == $find) {
return $price;
break;
}}}
The $price
return runs correctly for each of the above elements of the array which i choose through a simple html form.
Now my code
function get_tickets($find){
$xml = simplexml_load_file("products.xml");
// Here i want to return some of the xml's elements
}
and the included xml file
<products>
<company>
<name>test</name>
<tel>test</tel>
</company>
<products>
<product id="1">
<name>test</name>
<value>test</value>
<color>test</color>
</product>
</products>
</products>
I want to be able to access all the elements of the xml like the first sample code. Thank you.