PHP 中的引用

发布于 2024-07-08 21:55:08 字数 140 浏览 13 评论 0原文

我正在编写一个自定义博客引擎,并且希望拥有类似于 Wordpress 的引用。 我可以查看 WordPress 源代码,但我真的更喜欢某种教程,但到目前为止我还没有找到。 有没有关于在 PHP5 中实现 trackbacks 或 pingbacks 的好的教程?

I'm writing a custom blog engine and would like to have trackbacks similar to Wordpress. I could look at the Wordpress source, but I'd really prefer a tutorial of some sort and so far I haven't been able to find one. Are there any good tutorials for implementing trackbacks or pingbacks in PHP5?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

私野 2024-07-15 21:55:08

实现引用引用一点也不难。 在这里您可以找到官方规范和底部的示例。

Implementing trackbacks isn't that hard at all. Here you can find the official specification and an example at the bottom.

醉酒的小男人 2024-07-15 21:55:08

引用通告很好,但它们很容易成为垃圾邮件,因为无法验证其来源。 您可以使用简单的发现方法来查找 Trackpack 入口点; 在目标站点的源中查找 RDF。 然后,它只是向目标站点的引用引用入口点发送必要的引用引用信息的 RESTful POST 请求。 Sebastian Hörl 链接的规范应该为您提供大量相关信息。

Pingbacks 稍微复杂一些,因为它们需要 XMLRPC 和 linkback。 因此,虽然您可以仅使用 REST 调用向任何站点发送匿名引用,但您 pingback 的站点将查看您的站点,以确定您是否确实链接到了 ping 页面。

另外,在接收端实现 Pingback 有点复杂,因为您必须验证 ping。 我想你不必这样做,但不这样做是愚蠢的,否则它很容易受到与引用引用相同的垃圾邮件技术的影响。

Pingback 规范 包含启动该实施所需的所有信息。

另一个建议是,不要费力地浏览不可避免的密集和意大利式的 WordPress Pingback 代码,看看 Habari 的独立的 Pingback 实现,它将任务的一些关键特征隔离成更容易理解的单元。

Trackbacks are fine, but they're very prone to spam, since there's no verification of their origin. You use a simple discovery method to find the trackpack entrypoint; look for RDF in the target site's source. Then it's simply a RESTful POST request to the destination site's trackback entrypoint passing the requisite trackback information. The specification linked by Sebastian Hörl should give you plenty of information for that.

Pingbacks are a bit more complex, because they require both XMLRPC and a linkback. So while you can just use REST calls to send anonymous trackbacks to any site, sites that you pingback will look at your site to determine whether you're actually linking to the pinged page.

Also, implementing Pingback on the receiving end is a little more complicated, because you have to verify the ping. I suppose you don't have to, but it would be foolish not to, otherwise it would be susceptible to the same spamming techniques as Trackbacks.

The Pingback specification has all the information you need to get that implementation off the ground.

Another recommendation is rather than wade through the inevitably dense and spaghetti-ish WordPress Pingback code, have a look at Habari's self-contained Pingback implementation, which isolates some of the key features of the task into more easily digestible units.

一向肩并 2024-07-15 21:55:08

不知道引用是什么,我所注意到的只是它们用凌乱的文本块弄乱了网站,并且经常穿插着文章评论。

但是,如果它们允许您在不进行日志分析的情况下实时查看谁链接到您:

您可以使用 HTTP-Referer (sic) 标头来查看人们是否链接到您的文章。
每篇文章都会有这些引荐来源网址的地图(以及计数,以便您可以按受欢迎程度进行组织)。 然后,您实现一个基本的爬虫程序,该爬虫程序访问新的引荐来源网址以抓取内容。

我确信也有第三方实施可用。 或者一个规格。 正如另一张海报所链接的那样,所以,错误,忽略这一点。

Dunno what trackbacks are, all I've noticed of them is that they clutter up websites with messy blocks of text, often interpersed with article comments.

But if they allow you to see who is linking to you in real time without log analysis:

You could use the HTTP-Referer (sic) header to see if people have linked to your article.
Each article would have a map of these referrers (and a count, so you can organise by popularity). You then implement a basic crawler that visits new referrers to scrape content.

I'm sure there's a third party implementation available as well. Or a specification. As the other poster has linked to, so, err, ignore this.

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