尝试解析/分解 xml feed

发布于 2024-12-04 04:38:26 字数 3148 浏览 1 评论 0原文

可能的重复:
PHP 的最佳 XML 解析器
我应该在 PHP 中使用什么 RSS 解析器?

我 尝试从 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜访吸血鬼 2024-12-11 04:38:26

您是否尝试过 SimpleXMLXML 解析器,甚至 XML 阅读器< /a>?

Have you tried SimpleXML or XML Parser, or even XML Reader?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文