Home php教程 php手册 如何用PHP把RDF内容插入Web站点之中(1)

如何用PHP把RDF内容插入Web站点之中(1)

Jun 21, 2016 am 09:02 AM
gt http lt

 

1)名誉和巨大的财富
设想一个从最热门的门户网站获得最新的新闻的站点。股票价格,天气信息,新闻故事,线式讨论组,软件发布……所有这一切都将被动态更新,每小时一次,不需要任何手工干预。我们可以想象这随之而来的站点访问量,源源不断的广告收入以及网管大人所受到的阿谀奉承
但是现在,停止幻想,开始阅读,因为只要你密切关注此项技术,说不定你就能成为站点的主人。 对你的要求也只是稍许的想象力,一些聪明的PHP编码和几个免费的RSS文件。另外,很明显还包括这篇文章剩下的九个部分。

2)
有内容,就联合成辛迪加(Have Content, Will Syndicate
我们从最基本的开始——那么RSS究竟是什么鬼东西呢?
RSS
(即RDF Site Summary)是一种格式,最早由Netscape公司设计,用于分发其门户站点My.Netscape.Com上的内容的描述信息。自1997年被提出以来,几经沉浮——可以点击文章末尾的链接,了解一下RSS悠久复杂的历史。现在的稳定的版本是RSS1.0,符合RDF规范。这一版本可以说即轻便又功能齐全。
RSS
使得网管及时公布和分发某一特定站点的特定位置的最新最有趣的内容的描述信息变的可能。 从新闻文章列表到股票市场数据或着是天气预报,所有这些信息都可以通过结构良好的XML文档来发布,从而也可以被任何XML分析器进行分析,处理和翻译。
网站上最新信息的列表是经常更新的,而RSS使得这一列表的分发成为可能,也就为Web上简易的内容辛迪加联合打开了大门。想了解这其中的道理,请看下面这个简单的例子:
站点A属新闻站点(内容辛迪加组织者),能够每小时发布一个包含最新新闻列表以及相应链接的RSS文档。 而这一RSS文档可以被其它站点获取(如站点B内容收集者),分析并显示在站点B的索引页面上。 每次站点A发布一个新的RSS文档,站点B的索引页面都可以自动更新,以获取最新的新闻。
这种方案对交易中的双方机构都有效。 既然RSS文档中的链接都指向站点A上相应的文章,那么站点A将迅速体验到访问量的增加。 而站点B的网管可以休假一个星期,因为他有办法自动更新其站点上的索引页面,而这一方法仅仅是把索引页面与站点A发布的动态内容相连接而已。
有许多受欢迎的站点向公众提供详细的RSSRDF新闻,如Freshmeathttp://www.freshmeat.net)和Slashdothttp://www.slashdot.org),当然还有其它许多站点。在这篇文章当中,我将广泛的使用Freshmeat网站的RDF文件。需要说明的一点是,这里所谈到的技术也可以应用于其它任何RSS1.0RDF文件。

3)
交换频道(Switching Channels
典型的RSS文档包含一个由描述性元数据标记出来的资源列表(URLs),请看下面的例子:

rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/">

rdf:about="http://www.melonfire.com/">
<span class="SpellE">Trog</span>
Well-written technical articles and
tutorials on Web technologies


http://www.melonfire.com/community/columns/trog/

rdf:Seq>
li
rdf:resource="http://www.melonfire.com/community/columns/trog/article.ph
p?id
=100" />
li
rdf:resource="http://www.melonfire.com/community/columns/trog/article.ph
p?id
=71" />
li
rdf:resource="http://www.melonfire.com/community/columns/trog/article.ph
p?id
=62" />
rdf:Seq>



rdf:about="http://www.melonfire.com/community/columns/trog/article.php?i
d=10
0">

Building A PHP-Based Mail Client (part 1)

http://www.melonfire.com/community/columns/trog/article.php?id=100
li
nk>
Ever wondered how Web-based mail clients
work? Find out here.



rdf:about="http://www.melonfire.com/community/columns/trog/article.php?i
d=71">
Using PHP With XML (part 1)

http://www.melonfire.com/community/columns/trog/article.php?id=71/link>
Use PHP''s SAX parser to parse XML data and
generate HTML pages.



rdf:about="http://www.melonfire.com/community/columns/trog/article.php?i
d=62">
Access Granted

http://www.melonfire.com/community/columns/trog/article.php?id=62/link>
Precisely control access to information
with the mySQL grant tables.



你可以看到,RDF文件由几个界限分明的部分组成。首先是文档序码prolog),
xml version="1.0" encoding="UTF-8"?>
然后是根元素中的名称空间声明。
rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/">
接着是部分,这部分包含了RDF所要描述的频道的一般信息。在上面的例子中,频道是Melonfire网站的Trog专栏,专栏内容是新的技术文章和指南,每星期更新一次。
rdf:about
="http://www.melonfire.com/">
<span class="SpellE">Trog</span>
Well-written technical articles and
tutorials on Web technologies


http://www.melonfire.com/community/columns/trog/

rdf:Seq>
li
rdf:resource="http://www.melonfire.com/community/columns/trog/article.ph
p?id
=100" />
li
rdf:resource="http://www.melonfire.com/community/columns/trog/article.ph
p?id
=71" />
li
rdf:resource="http://www.melonfire.com/community/columns/trog/article.ph
p?id
=62" />
rdf:Seq>


区包含了一个区块,区块又包含了文档中描述的所有资源的一个顺序列表。该列表通过一系列的li />元素来表示。区块中每一个资源都在后面的区块中有更详细的描述。
items
>
rdf:Seq>
li
rdf:resource="http://www.melonfire.com/community/columns/trog/article.ph
p?id
=100" />



Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What are the differences between Huawei GT3 Pro and GT4? What are the differences between Huawei GT3 Pro and GT4? Dec 29, 2023 pm 02:27 PM

Many users will choose the Huawei brand when choosing smart watches. Among them, Huawei GT3pro and GT4 are very popular choices. Many users are curious about the difference between Huawei GT3pro and GT4. Let’s introduce the two to you. . What are the differences between Huawei GT3pro and GT4? 1. Appearance GT4: 46mm and 41mm, the material is glass mirror + stainless steel body + high-resolution fiber back shell. GT3pro: 46.6mm and 42.9mm, the material is sapphire glass + titanium body/ceramic body + ceramic back shell 2. Healthy GT4: Using the latest Huawei Truseen5.5+ algorithm, the results will be more accurate. GT3pro: Added ECG electrocardiogram and blood vessel and safety

What does http status code 520 mean? What does http status code 520 mean? Oct 13, 2023 pm 03:11 PM

HTTP status code 520 means that the server encountered an unknown error while processing the request and cannot provide more specific information. Used to indicate that an unknown error occurred when the server was processing the request, which may be caused by server configuration problems, network problems, or other unknown reasons. This is usually caused by server configuration issues, network issues, server overload, or coding errors. If you encounter a status code 520 error, it is best to contact the website administrator or technical support team for more information and assistance.

What is http status code 403? What is http status code 403? Oct 07, 2023 pm 02:04 PM

HTTP status code 403 means that the server rejected the client's request. The solution to http status code 403 is: 1. Check the authentication credentials. If the server requires authentication, ensure that the correct credentials are provided; 2. Check the IP address restrictions. If the server has restricted the IP address, ensure that the client's IP address is restricted. Whitelisted or not blacklisted; 3. Check the file permission settings. If the 403 status code is related to the permission settings of the file or directory, ensure that the client has sufficient permissions to access these files or directories, etc.

How to use Nginx Proxy Manager to implement automatic jump from HTTP to HTTPS How to use Nginx Proxy Manager to implement automatic jump from HTTP to HTTPS Sep 26, 2023 am 11:19 AM

How to use NginxProxyManager to implement automatic jump from HTTP to HTTPS. With the development of the Internet, more and more websites are beginning to use the HTTPS protocol to encrypt data transmission to improve data security and user privacy protection. Since the HTTPS protocol requires the support of an SSL certificate, certain technical support is required when deploying the HTTPS protocol. Nginx is a powerful and commonly used HTTP server and reverse proxy server, and NginxProxy

Fix: Snipping tool not working in Windows 11 Fix: Snipping tool not working in Windows 11 Aug 24, 2023 am 09:48 AM

Why Snipping Tool Not Working on Windows 11 Understanding the root cause of the problem can help find the right solution. Here are the top reasons why the Snipping Tool might not be working properly: Focus Assistant is On: This prevents the Snipping Tool from opening. Corrupted application: If the snipping tool crashes on launch, it might be corrupted. Outdated graphics drivers: Incompatible drivers may interfere with the snipping tool. Interference from other applications: Other running applications may conflict with the Snipping Tool. Certificate has expired: An error during the upgrade process may cause this issu simple solution. These are suitable for most users and do not require any special technical knowledge. 1. Update Windows and Microsoft Store apps

Understand common application scenarios of web page redirection and understand the HTTP 301 status code Understand common application scenarios of web page redirection and understand the HTTP 301 status code Feb 18, 2024 pm 08:41 PM

Understand the meaning of HTTP 301 status code: common application scenarios of web page redirection. With the rapid development of the Internet, people's requirements for web page interaction are becoming higher and higher. In the field of web design, web page redirection is a common and important technology, implemented through the HTTP 301 status code. This article will explore the meaning of HTTP 301 status code and common application scenarios in web page redirection. HTTP301 status code refers to permanent redirect (PermanentRedirect). When the server receives the client's

Send POST request with form data using http.PostForm function Send POST request with form data using http.PostForm function Jul 25, 2023 pm 10:51 PM

Use the http.PostForm function to send a POST request with form data. In the http package of the Go language, you can use the http.PostForm function to send a POST request with form data. The prototype of the http.PostForm function is as follows: funcPostForm(urlstring,dataurl.Values)(resp*http.Response,errerror)where, u

Quick Application: Practical Development Case Analysis of PHP Asynchronous HTTP Download of Multiple Files Quick Application: Practical Development Case Analysis of PHP Asynchronous HTTP Download of Multiple Files Sep 12, 2023 pm 01:15 PM

Quick Application: Practical Development Case Analysis of PHP Asynchronous HTTP Download of Multiple Files With the development of the Internet, the file download function has become one of the basic needs of many websites and applications. For scenarios where multiple files need to be downloaded at the same time, the traditional synchronous download method is often inefficient and time-consuming. For this reason, using PHP to download multiple files asynchronously over HTTP has become an increasingly common solution. This article will analyze in detail how to use PHP asynchronous HTTP through an actual development case.

See all articles