尝试解析/分解 xml feed
我 尝试从 Godaddy 的拍卖 XML feed 中推断出一些数据。它看起来像这样:
<?xml version='1.0' ?><!-- pageok --><rss version='2.0' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:admin='http://webns.net/mvcb/' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:slash='http://purl.org/rss/1.0/modules/slash/' xmlns:wfw='http://wellformedweb.org/CommentAPI/' xmlns:content='http://purl.org/rss/1.0/modules/content/'><channel><title>Go Daddy Auctions - All Auctions Ending Today</title><link>https://auctions.godaddy.com/trpHome.aspx?isc=rssTD01</link><description>All Auctions ending today at Go Daddy Auctions</description><language>en-us</language><copyright>Copyright 2011</copyright><lastBuildDate>Mon, 12 Sep 2011 14:00:42 GMT</lastBuildDate><ttl>60</ttl><image><url>http://img1.wsimg.com/fos/img/img_logo_65x65_white.jpg</url><title>Go Daddy Auctions - auctions.godaddy.com</title><link>https://auctions.godaddy.com/trpHome.aspx?isc=rssTD01</link></image><item><title>Auctions Ending Today</title><link><![CDATA[https://auctions.godaddy.com/trpSearchResults.aspx?ra=4236071220110900&isc=rssTD01]]></link><description><![CDATA[The domains people want are going fast at auctions.godaddy.com]]></description><guid><![CDATA[https://auctions.godaddy.com/trpSearchResults.aspx?ra=4236071220110900&isc=rssTD01]]></guid></item>
<item><title>NEXTKILL.COM</title><link><![CDATA[https://auctions.godaddy.com/trpItemListing.aspx?miid=56665411&isc=rssTD01]]></link><description><![CDATA[Auction Type: Bid, Auction End Time: 09/12/2011 06:00 AM (PDT), Asking Price/Current Bid: $60, Number of Bids: 0, Domain Age: 0, Description: , Traffic: 3983, Valuation: $0, IsAdult: false]]></description><guid><![CDATA[https://auctions.godaddy.com/trpItemListing.aspx?miid=56665411]]></guid></item>
<item><title>JEANLEGGINGS.COM</title><link><![CDATA[https://auctions.godaddy.com/trpItemListing.aspx?miid=55617299&isc=rssTD01]]></link><description><![CDATA[Auction Type: Bid, Auction End Time: 09/12/2011 07:45 AM (PDT), Asking Price/Current Bid: $50, Number of Bids: 1, Domain Age: 0, Description: , Traffic: 0, Valuation: $0, IsAdult: false]]></description><guid><![CDATA[https://auctions.godaddy.com/trpItemListing.aspx?miid=55617299]]></guid></item>
我想做的是获取列表的部分内容,例如网址、价格等。
我尝试过按 /n 进行爆炸,但我认为这不起作用,因为事情位于不同的行上。
有什么想法吗?
谢谢, 缺口
Possible Duplicate:
Best XML Parser for PHP
What RSS parser should I use in PHP?
I'm trying to extrapolate some data from Godaddy's auction XML feed. It looks like this:
<?xml version='1.0' ?><!-- pageok --><rss version='2.0' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:admin='http://webns.net/mvcb/' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:slash='http://purl.org/rss/1.0/modules/slash/' xmlns:wfw='http://wellformedweb.org/CommentAPI/' xmlns:content='http://purl.org/rss/1.0/modules/content/'><channel><title>Go Daddy Auctions - All Auctions Ending Today</title><link>https://auctions.godaddy.com/trpHome.aspx?isc=rssTD01</link><description>All Auctions ending today at Go Daddy Auctions</description><language>en-us</language><copyright>Copyright 2011</copyright><lastBuildDate>Mon, 12 Sep 2011 14:00:42 GMT</lastBuildDate><ttl>60</ttl><image><url>http://img1.wsimg.com/fos/img/img_logo_65x65_white.jpg</url><title>Go Daddy Auctions - auctions.godaddy.com</title><link>https://auctions.godaddy.com/trpHome.aspx?isc=rssTD01</link></image><item><title>Auctions Ending Today</title><link><![CDATA[https://auctions.godaddy.com/trpSearchResults.aspx?ra=4236071220110900&isc=rssTD01]]></link><description><![CDATA[The domains people want are going fast at auctions.godaddy.com]]></description><guid><![CDATA[https://auctions.godaddy.com/trpSearchResults.aspx?ra=4236071220110900&isc=rssTD01]]></guid></item>
<item><title>NEXTKILL.COM</title><link><![CDATA[https://auctions.godaddy.com/trpItemListing.aspx?miid=56665411&isc=rssTD01]]></link><description><![CDATA[Auction Type: Bid, Auction End Time: 09/12/2011 06:00 AM (PDT), Asking Price/Current Bid: $60, Number of Bids: 0, Domain Age: 0, Description: , Traffic: 3983, Valuation: $0, IsAdult: false]]></description><guid><![CDATA[https://auctions.godaddy.com/trpItemListing.aspx?miid=56665411]]></guid></item>
<item><title>JEANLEGGINGS.COM</title><link><![CDATA[https://auctions.godaddy.com/trpItemListing.aspx?miid=55617299&isc=rssTD01]]></link><description><![CDATA[Auction Type: Bid, Auction End Time: 09/12/2011 07:45 AM (PDT), Asking Price/Current Bid: $50, Number of Bids: 1, Domain Age: 0, Description: , Traffic: 0, Valuation: $0, IsAdult: false]]></description><guid><![CDATA[https://auctions.godaddy.com/trpItemListing.aspx?miid=55617299]]></guid></item>
what I want to do is get parts of the listings, such as the url, price, etc.
I've tried exploding by /n, but I think this doesnt work because things are on different lines.
Any ideas?
Thanks,
Nick
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过 SimpleXML 或 XML 解析器,甚至 XML 阅读器< /a>?
Have you tried SimpleXML or XML Parser, or even XML Reader?