ciao a tutti in ASP per parsare sul mio dominio un feed presente su un altro e poi poterlo andare a leggere in flash faccio questo:
codice:<% dim strError, strURL strURL = "http://www.borse.it/rss/news_rss.xml" dim xmlDom, nodeCol, oNode, oChildNode set xmlDom = Server.CreateObject("MSXML2.Domdocument") xmlDOM.async = False call xmlDom.setProperty("ServerHTTPRequest", true) xmlDom.async = false call xmlDom.load(strURL) if not xmlDom.documentElement is nothing then set nodeCol = xmlDom.documentElement.selectNodes("channel/item") ii = 1 Response.ContentType = ("text/xml" ) Response.Write("<?xml version='1.0' encoding='iso-8859-1'?>") for each objNode in nodeCol Response.Write("<item>")'& vbCrLf) set oChildNode = objNode.selectSingleNode("pubDate") if not oChildNode is nothing then strPubDate = Server.HTMLEncode(oChildNode.text) 'strPubDate = replace(strPubDate, "'", "'") 'strPubDate = replace(strPubDate, "&", "&") 'strPubDate = replace(strPubDate, vbCrLf, " ") ' Response.Write("" & strPubDate & " " & vbCrLf) end if set oChildNode = objNode.selectSingleNode("link") if not oChildNode is nothing then Response.Write("<url>" & oChildNode.text & "</url>") strLink = "yes" end if set oChildNode = objNode.selectSingleNode("title") if not oChildNode is nothing then strTitle = Server.HTMLEncode(oChildNode.text) 'strTitle = replace(strTitle, "'", "'") 'strTitle = replace(strTitle, "&", "&") 'strTitle = replace(strTitle, vbCrLf, " ") Response.Write("<title>" & strTitle & "</title>") 'Response.Write("<url>" & strLink & "</url>") end if ' if strLink = "yes" then ' Response.Write("</item>" )'& vbCrLf) ' end if ii = ii + 1 Response.Write("</item>")' & vbCrLf) next else Response.Write(strError & vbCrLf) end if %>
il file asp mi restituisce questo
come posso fare la stessa cosa in php?codice:<?xml version='1.0' encoding='iso-8859-1'?><item><url>http://www.borse.it/News.php?IDNews=118334</url><title> Zona Euro: Pil quarto trimestre +0,4% t/t e +2,2% a/a </title></item><item><url>http://www.borse.it/News.php?IDNews=118333</url><title> Intesa Sanpaolo: JP Morgan taglia giudizio a neutral </title></item><item><url>http://www.borse.it/News.php?IDNews=118332</url><title> Futures su indici </title></item><item><url>http://www.borse.it/News.php?IDNews=118331</url><title> Seat PG: Fitch conferma rating BB- ma riduce outlook a negativo </title></item><item><url>http://www.borse.it/News.php?IDNews=118330</url><title> Citigroup: vicina cessione di prestiti rischiosi per 12 mld USD </title></item><item><url>http://www.borse.it/News.php?IDNews=118329</url><title> Datalogic: chiuso trim.1 con ricavi pari a 96,8 mln, bene ordinativi </title></item><item><url>http://www.borse.it/News.php?IDNews=118328</url><title> Futures su indici </title></item><item><url>http://www.borse.it/News.php?IDNews=118327</url><title> Germania: surplus commerciale febbraio 16,9 mld euro, meglio di attese </title></item><item><url>http://www.borse.it/News.php?IDNews=118326</url><title> Ups: tagliate stime su utile per azione primo trimestre </title></item><item><url>http://www.borse.it/News.php?IDNews=118325</url><title> Petrolio: prezzo Opec sale a 101,89 dollari al barile </title></item><item><url>http://www.borse.it/News.php?IDNews=118324</url><title> Edison: perfezionata cessione di 7 centrali </title></item><item><url>http://www.borse.it/News.php?IDNews=118323</url><title> Giappone: Banca Centrale lascia tassi fermi allo 0,5% </title></item><item><url>http://www.borse.it/News.php?IDNews=118322</url><title> Dati di apertura </title></item><item><url>http://www.borse.it/News.php?IDNews=118320</url><title> Usa: verbali Fed,esiste possibilità di severa contrazione per economia </title></item><item><url>http://www.borse.it/News.php?IDNews=118319</url><title> Alitalia: titoli tornano in negoziazione con unica fase d'asta </title></item><item><url>http://www.borse.it/News.php?IDNews=118318</url><title> Alitalia: liquidità aprile a 239 mln, necessarie soluzioni nel breve </title></item><item><url>http://www.borse.it/News.php?IDNews=118321</url><title> Chiusura Borse Usa </title></item><item><url>http://www.borse.it/News.php?IDNews=118316</url><title> ALITALIA: CDA ESAMINA RISCHIO CRISI, RESTA POCO TEMPO /ANSA </title></item><item><url>http://www.borse.it/News.php?IDNews=118317</url><title> MUTUI:FMI;QUASI 1.000 MILIARDI PERDITE,MERCATO PEGGIORA/ANSA </title></item><item><url>http://www.borse.it/News.php?IDNews=118314</url><title> Dati di chiusura </title></item>

Rispondi quotando