GIÁ VÀNG HÔM NAY

GIÁ VÀNG HÔM NAY
function tygiavang(){
    $Link = $Link2 = '';
    $dir='cache/';
    if(!is_dir($dir)) mkdir($dir,0755,true);
    $Link = $dir.'tygiavang.xml';
    $Link2 = 'http://www.sjc.com.vn/xml/tygiavang.xml';
    $content = @file_get_contents($Link2);
    if($content==''){
      $content = @file_get_contents($Link);
    }else{
      copy($Link2,$Link);
    } 
    $xml=simplexml_load_string($content);
    return $xml;
}
<?php
$data=tygiavang();
?>
<table border="1">
    <tr bgcolor="yellow">
        <td>Thành phố</td>
        <td>Type</td>
        <td>Sell</td>
        <td>Buy</td>
         
    </tr>
<?php
foreach($data->ratelist->city as $item){
?>
    <tr>
        <td <?php if(count($item->item)>1){?>rowspan="<?php echo count($item->item)+1?>" <?php }?>><?php echo (string)$item['name']?></td>
        <?php 
        $first=reset($item->item);
        next($item);
        ?>
        <td><?php echo (string)$first['type']?></td>
        <td><?php echo (string)$first['sell']?></td>
        <td><?php echo (string)$first['buy']?></td>
    </tr>
    <?php
    if(count($item->item)>1){
        foreach($item->item as $t){
    ?>
        <tr>
            <td><?php echo (string)$t['type']?></td>
            <td><?php echo (string)$t['sell']?></td>
            <td><?php echo (string)$t['buy']?></td>
        </tr>
    <?php
        }
    }
    ?>
<?php
}
?>
</table>
function tygiavang(){ $Link = $Link2 = ”; $dir=’cache/’; if(!is_dir($dir)) mkdir($dir,0755,true); $Link = $dir.’tygiavang.xml’; $Link2 = ‘http://www.sjc.com.vn/xml/tygiavang.xml’; $content = @file_get_contents($Link2); if($content==”){ $content = @file_get_contents($Link); }else{ copy($Link2,$Link); } $xml=simplexml_load_string($content); return $xml; }
READ  Giá vàng tăng liên tục 3 tuần: Dự báo lập đỉnh mới

Để lại một bình luận

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *