doucuo4413 2012-01-07 20:29
浏览 18
已采纳

应该在Superfeedr的回调文件中写什么?

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.

  • 写回答

2条回答 默认 最新

  • doujianglin6704 2012-01-08 18:48
    关注

    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. to verify your intent (to confirm that you want to subscribe)
    2. to notify you of new content.

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

    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.

    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.

    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).

    I hope this helps!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度