0

我正在学习 RSS 解析——事实上我对它很陌生。我想知道在 php 中接收 RSS 提要的概念。但随后使用该项目的 RSS 链接转到新页面,然后解析该页面以查找与其关联的图像(假设图像编号不同,但后续页面上的 html 没有)

这样的事情可能吗?没关系,我不要求您提供细节/为我做这件事。只是对这个概念进行一些简短的教育。

比如说这个网站: http ://www.bulettings.com/

它有一个 RSS 源: http ://www.bulettings.com/propertyrss

对每个项目说:

<item>
<title>
House Let @ &#163;2,400 per month, Chatsworth Rd, Charminster, BH8
</title>
<link>
http://www.bulettings.com/property/chatsworth-rd-charminster-bh8/buni-000690/1
</link>
<description>
<a href="http://www.bulettings.com/property/chatsworth-rd-charminster-bh8/buni-000690/1"><img src="http://www.estateagentslive.net/pchomesdata/BOURNEMOUTHUNI/PHOTOS/buni-000690-p-w-3nm0z5lor.jpg" width="150" alt="" align="left" border="0" /></a>STUDENT HOUSE - Large modernised seven bedroom House in Charminster with partial double glazing. Also has garden off road parking and bike storage.
</description>
<guid isPermaLink="true">
http://www.bulettings.com/property/chatsworth-rd-charminster-bh8/buni-000690/1
</guid>
<pubDate>Mon, 04 Feb 2013 14:02:13 GMT</pubDate>
<enclosure length="29" url="http://www.estateagentslive.net/pchomesdata/BOURNEMOUTHUNI/PHOTOS/buni-000690-p-w-3nm0z5lor.jpg" type="image/jpg"/>
</item>

我得到了这些信息,但随后我说“转到”,这会将我带到一个页面,其中来源是:

<script type="text/javascript">
    if(document.images){ 
 currentphoto=1; 
 maxphotos=7; 
    photo = new Array(7); 
    Imagetext = new Array(7); 
photo[1]=new Image();
photo[1].src="http://www.estateagentslive.net/pchomesdata/BOURNEMOUTHUNI/PHOTOS/buni-000690-p-w-3nm0z5lor.jpg";
Imagetext[1] ="Photo 1";
photo[2]=new Image();
photo[2].src="http://www.estateagentslive.net/pchomesdata/BOURNEMOUTHUNI/PHOTOS/buni-000690-p-w-3nm0z5svv.jpg";
Imagetext[2] ="Photo 2";
photo[3]=new Image();
photo[3].src="http://www.estateagentslive.net/pchomesdata/BOURNEMOUTHUNI/PHOTOS/buni-000690-p-w-3nm0z5j86.jpg";
Imagetext[3] ="Photo 3";
photo[4]=new Image();
photo[4].src="http://www.estateagentslive.net/pchomesdata/BOURNEMOUTHUNI/PHOTOS/buni-000690-p-w-3nm0z5vc2.jpg";
Imagetext[4] ="Photo 4";
photo[5]=new Image();
photo[5].src="http://www.estateagentslive.net/pchomesdata/BOURNEMOUTHUNI/PHOTOS/buni-000690-p-w-3pd0xwvp9.jpg";
Imagetext[5] ="Photo 5";
photo[6]=new Image();
photo[6].src="http://www.estateagentslive.net/pchomesdata/BOURNEMOUTHUNI/PHOTOS/buni-000690-p-w-3nm0z5gq9.jpg";
Imagetext[6] ="Photo 6";
photo[7]=new Image();
photo[7].src="http://www.estateagentslive.net/pchomesdata/BOURNEMOUTHUNI/PHOTOS/buni-000690-p-w-3nm0z5qhr.jpg";
Imagetext[7] ="Photo 7";
photo[8]=new Image();
photo[8].src="http://www.estateagentslive.net/pchomesdata/BOURNEMOUTHUNI/PHOTOS/buni-000690-p-w-3mr0yds1e.jpg";
Imagetext[8] ="Photo 8";

 }
</script>

或者在页面下方:

<ul>

<li><img src="http://www.estateagentslive.net/pchomesdata/BOURNEMOUTHUNI/PHOTOS/buni-000690-p-w-3nm0z5lor.jpg" width="1024" height="768" onmouseover="document.images['photoview'].src = this.src;" alt="Photo 4" title="Photo 4"/></li>
<li><img src="http://www.estateagentslive.net/pchomesdata/BOURNEMOUTHUNI/PHOTOS/buni-000690-p-w-3nm0z5svv.jpg" width="1024" height="768" onmouseover="document.images['photoview'].src = this.src;" alt="Photo 7" title="Photo 7"/></li>
<li><img src="http://www.estateagentslive.net/pchomesdata/BOURNEMOUTHUNI/PHOTOS/buni-000690-p-w-3nm0z5j86.jpg" width="1024" height="768" onmouseover="document.images['photoview'].src = this.src;" alt="Photo 3" title="Photo 3"/></li>
<li><img src="http://www.estateagentslive.net/pchomesdata/BOURNEMOUTHUNI/PHOTOS/buni-000690-p-w-3nm0z5vc2.jpg" width="1024" height="768" onmouseover="document.images['photoview'].src = this.src;" alt="Photo 8" title="Photo 8"/></li>
<li><img src="http://www.estateagentslive.net/pchomesdata/BOURNEMOUTHUNI/PHOTOS/buni-000690-p-w-3pd0xwvp9.jpg" width="1024" height="768" onmouseover="document.images['photoview'].src = this.src;" alt="Photo 2" title="Photo 2"/></li>
<li><img src="http://www.estateagentslive.net/pchomesdata/BOURNEMOUTHUNI/PHOTOS/buni-000690-p-w-3nm0z5gq9.jpg" width="1024" height="768" onmouseover="document.images['photoview'].src = this.src;" alt="Photo 2" title="Photo 2"/></li>
<li><img src="http://www.estateagentslive.net/pchomesdata/BOURNEMOUTHUNI/PHOTOS/buni-000690-p-w-3nm0z5qhr.jpg" width="1024" height="768" onmouseover="document.images['photoview'].src = this.src;" alt="Photo 6" title="Photo 6"/></li>
<li><img src="http://www.estateagentslive.net/pchomesdata/BOURNEMOUTHUNI/PHOTOS/buni-000690-p-w-3mr0yds1e.jpg" width="1024" height="768" onmouseover="document.images['photoview'].src = this.src;" alt="Photo 1" title="Photo 1"/></li>
</ul>

因此,它会从 rss 中获取该信息以及有关它的信息,将其放在某个地方并删除所有垃圾,然后将其与图像链接一起保留。然后继续下一个项目。

可以这样做吗?

4

1 回答 1

1

我会使用 simplepie 将提要分成可访问的部分。它非常易于使用。

get_enclosure可能是您想要关注的内容。

这是一个“入门”示例,展示了它的易用性。

于 2013-02-14T00:13:16.590 回答