Jump to content

xml


alin19

Recommended Posts

i must get an xml that looks like this:

 

<ArrayOfTypeLevel1>

<TypeLevel1>

<Symbolcode>AER</Symbolcode>

<Marketcode>UNLS</Marketcode>

<LastTradeTime>2008-08-08T12:00:21.57+03:00</LastTradeTime>

<Openprice>4.6000</Openprice>

<Closeprice>4.4000</Closeprice>

<Value>1620.6800</Value>

<Volume>343</Volume>

<Trades>9</Trades>

<Lowpricecurrent>4.4000</Lowpricecurrent>

<Highpricecurrent>4.9700</Highpricecurrent>

<Avgprice>4.7300</Avgprice>

<NetChgFromOfficialPrice>-0.2000</NetChgFromOfficialPrice>

<PrcChgFromOfficialPrice>-4.35</PrcChgFromOfficialPrice>

<ReferencePrice>4.6000</ReferencePrice>

<SymbolStatus>OPENED</SymbolStatus>

</TypeLevel1>

.....

 

i've tryed diferent ways to get this content but i can't do it, can you help me?

 

 

<?php

 

$URL = "page adress";

 

 

$xml = @simplexml_load_file($URL);

 

 

foreach ($xml->TypeLevel1 as $item) {

 

$symbol = $item->Symbolcode;

 

 

echo $symbol;

}

?>

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/118771-xml/
Share on other sites

if i try to use this:

<html>

<?php

$url  = 'page ';

    $curs = file_get_contents($url);


$xml = new SimpleXMLElement($curs);





foreach( $xml->TypeLevel1 as $rate ){

    $final = array();


    $final['Symbolcode'] = (string) $rate;



}


?>
</html>

i get the errors

Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: Entity: line 2: parser warning : xmlns: URI www.bvb.ro is not absolute in /opt/lampp/htdocs/curs_val.php on line 10

 

Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: Schema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="www.bvb.ro" in /opt/lampp/htdocs/curs_val.php on line 10

 

Warning: SimpleXMLElement::__construct() [function.SimpleXMLElement---construct]: ^ in /opt/lampp/htdocs/curs_val.php on line 10

Link to comment
https://forums.phpfreaks.com/topic/118771-xml/#findComment-611567
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.