Salve, chiedo scusa ma non ho mai programmato in php.
Dovrei leggere questo file xml ed inserire nel db access.
Il primo dubbio:
posso usare la stessa connessione che uso in altre pagine asp?
Questo l'intero codice:
codice:
<%
session("referer")= session("pagina")
session("pagina")= "http://"&request.ServerVariables("HTTP_HOST")&request.ServerVariables("PATH_INFO")&"?"&request.QueryString()
Dim Conn
Dim strConnect
Set Conn = Server.CreateObject("ADODB.Connection")
StrConnect = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & server.mappath("/mdb-database/ecom.mdb") & ";Persist Security Info = False"
Conn.open StrConnect
%>
<?php
//This is aPHP(5)script example on how eurofxref-daily.xml can be parsed
//Read eurofxref-daily.xml file in memory
//For the next command you will need the config option allow_url_fopen=On (default)
$XML=simplexml_load_file("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml");
//the file is updated daily between 2.15 p.m. and 3.00 p.m. CET
foreach($XML->Cube->Cube->Cube as $rate){
//Output the value of 1EUR for a currency code
echo '1€='.$rate["rate"].' '.$rate["currency"].'
';
//--------------------------------------------------
{
mysql_query('INSERT INTO cambio VALUES ($rate["currency"] ,$rate["rate"])');
}
//Here you can add your code for inserting
//$rate["rate"] and $rate["currency"] into your database
//--------------------------------------------------
}
?>
Grazie