我应该在Superfeedr回调文件中写的? [英] What should be written in callback file of Superfeedr?

查看:130
本文介绍了我应该在Superfeedr回调文件中写的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要生成RSS提要并获得冠军和职位的网址等。我决定使用 Superfeedr 它。所以在这种情况下,我在Superfeedr订户。有回调(用户URL)现场得到的数据,但我不知道什么应该在回调的文件被写入。我研究网,例如code,但我发现一无所知例如code。顺便说一句,我想这样做在PHP这个过程。所以,如果你知道我应该怎么需要写入该文件,请评论。

I need to generate RSS feed and get title and urls of the posts and so on. I decided to use Superfeedr for it. So in this situation, I'm a subscriber in Superfeedr. There is callback (the subscriber URL) field to get data, but I don't know what should be written in callback file. I researched the net for example code, but I found nothing about example code. BTW, I want to do this process in PHP. So if you know what should I need write to this file, please comment.

推荐答案

约翰,我想你了... ...这是很好的。现在,在你的PHP写:这个回调URL(你的PHP文件),将在2个不同的情况下,被称为:

John, I think you got it... which is good. Now, what to write in your PHP: this callback url (your PHP file) will be called in 2 different cases:


  1. 要验证你的意图(以确认要订阅)

  2. 要通知你的新内容。

我不是PHP的人,但我会dscribe你的算法

I'm no PHP person, but I'll dscribe the algorithm for you

要区分这两者,你只需要看看请求的类型。如果它是一个GET请求,那么,它的意图的验证,如果它是一个POST请求,那么它的新内容的通知。

To differentiate between the two, you just have to look at the type of request. If it's a GET request, then, it's the verification of intent, and if it's a POST request, then it's the notification of new content.

如果它是内容的验证,你只需要回声作为GET参数(我相信回声$ _GET ['hub.challenge]提供的hub.challenge; 应该工作)。你也应该确认你真的想订阅,但您的应用程序的逻辑,我不知道它(大多数人只看了 $ _ GET ['hub.topic'] 在他们的数据库,如果它的存在,呼应了挑战。如果不是,回声别的东西。

If it's the verification of content, you just have to echo the hub.challenge provided as a GET param (I believe echo $_GET['hub.challenge']; should work). You should also verify that you really want to the subscription, but that the logic of your app and I don't know it (most people just look up the $_GET['hub.topic'] in their database and if it's there, echo the challenge. If not, echo something else.

如果这是新内容的通知,这是更复杂一点。你必须访问HTTP请求的主体(再次,不知道PHP是怎么做的,但我敢肯定有人可以帮),那么,分析它提取标题和URL,并处理它们,你会想(最人们会保存在他们的数据库)。

If it's the notification of new content, it's a bit more complex. You have to access the BODY of the HTTP request (again, not sure how PHP does it, but I'm sure somebody can help), then, parse it to extract the title and urls, and handle them as you would want (most people will save that in their databases).

我希望这有助于!

这篇关于我应该在Superfeedr回调文件中写的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆