So I have had this work with other XML documents, but it won't work on the current one.
I load the xml file into a variable, I then use a foreach to load the specific values into an array and then I use the array to display prices from the XML document later in the script. As I said...it works on other scripts but I need to know what I'm doing wrong for this specific XML document.
//Extract price data from marketstatfuel_xml.xml
$arr = array();
$xml = simplexml_load_file("marketstatfuel_xml.xml");
$i=0;
foreach($xml->evec_api->marketstat->type as $child){
$arr[$i]="{$child->sell->avg}";
$i=$i+1;
}
and here's a small sample of the xml:
<!-- Automatically generated data from EVE-Central.com -->
<!-- This is the new API :-) -->
<evec_api version="2.0" method="marketstat_xml">
<marketstat>
<type id="44">
<all>
<volume>14840082.00</volume>
<avg>5402.56</avg>
<max>70000.00</max>
<min>1.50</min>
<stddev>4650.70</stddev>
<median>5070.51</median>
</all>
<buy>
<volume>8586957.00</volume>
<avg>3156.99</avg>
<max>8000.00</max>
<min>1.50</min>
<stddev>1532.87</stddev>
<median>4000.00</median>
</buy>
<sell>
<volume>6253125.00</volume>
<avg>6846.25</avg>
<max>70000.00</max>
<min>3000.00</min>
<stddev>5371.68</stddev>
<median>5300.00</median>
</sell>
</type>
<type id="9832">
<all>
<volume>44568269.00</volume>
<avg>1178.73</avg>
<max>11499.99</max>
<min>1.00</min>
<stddev>1067.95</stddev>
<median>1073.51</median>
</all>
<buy>
<volume>27106747.00</volume>
<avg>770.02</avg>
<max>2000.00</max>
<min>1.00</min>
<stddev>368.45</stddev>
<median>694.00</median>
</buy>
<sell>
<volume>17461522.00</volume>
<avg>1450.79</avg>
<max>11499.99</max>
<min>789.00</min>
<stddev>1234.95</stddev>
<median>1199.49</median>
</sell>
</type>
</marketstat>
</evec_api>
I'm not sure if the stuff at the top of the xml document is messing it up though...