pragmaMx Support Forum

pragmaMx => Coder und Bastlerecke => Thema gestartet von: Franky in 11 Februar 2010, 11:51:35

Titel: PHP-Frage
Beitrag von: Franky in 11 Februar 2010, 11:51:35
Hi,

an die PHP-Freaks hier :-)

Wie kann ich beiliegender PHP-Datei klarmachen, dass sie die Werte aus rate[1] und currencycode[1] in eine neue Datei schreibt (csv, semikolon getrennt)?
<?php
$XMLContent
file("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml");
foreach (
$XMLContent as $line) {
        if (
ereg("currency='([[:alpha:]]+)'",$line,$currencyCode)) {
            if (
ereg("rate='([[:graph:]]+)'",$line,$rate)) {
                    
//Output the value of 1 EUR for a currency code 
                    
echo '1 &euro; = '.$rate[1].' '.$currencyCode[1].'<br />';
                    
//--------------------------------------------------
                    // Here you can add your code for inserting
                    // $rate[1] and $currencyCode[1] into your database
                    //--------------------------------------------------
            
}
        }
}
?>


Mercie! :-)
Titel: Re: PHP-Frage
Beitrag von: Andi in 11 Februar 2010, 13:20:41
Hoi :)

gugg mal da:
http://de2.php.net/manual/de/function.file-put-contents.php