Hi, i have the following working code to put xml values into an array.. however sometimes there can be multiple engine codes? how can i write to the array and read back from the array?
Please can anyone advise???
below is my code...
Many thanks,
Brian.
Please can anyone advise???
below is my code...
Code:
<?php
$REG = "";
if (isset($_POST["REG"])) {
$VRM = $_POST["VRM"];
$xml = file_get_contents("[URL unfurl="true"]http://www.xxx.com/gateway1_0?reg="[/URL] . $REG . ");
}
$p = xml_parser_create();
xml_parse_into_struct($p, $xml, $vals, $index);
xml_parser_free($p);
$output = array();
$desiredOutput = array(''VIN','VEHICLE_YEAR','MAKE','MODEL','ENGINE_NO'); //add the things you want to retrieve here
foreach ($desiredOutput as $o){
if (isset($index[$o])){
$key = $index[$o][0];
$output[$o] = trim( $vals[$key]['value'] );
}
}
session_register("$VIN");
session_register("$VEHICLE_YEAR");
session_register("$MAKE");
session_register("$MODEL");
session_register("$ENGINE_NO");
Many thanks,
Brian.