I am trying to capture the XML data in a Node Named "listing-id".
I create the object and look at the nodes within the object and they all work except one which has a "-" in the name. Here is how I am trying to capture the data but its not working. Any suggestions?
$xmlObj = simplexml_load_file("http://somewebsite.com/file.xml");
$vehObject = $xmlObj->listings->listing;
//begin for each loop
$stockNo = $vehObject[$i]->listing-id; //returns "0" instead of real stock number.
$VIN = $vehObject[$i]->vin; // this VIN returns just fine....
//end for each loop
As you can see above I am trying for multiple data points... the VIN (and other fields) works just fine. The stockNo is not returning and the only difference is the "-" from all the other nodes.
Thanks in advance!