PHP如果正在通过URL获取脚本(PHP If Script is being fetched by URL)

编程入门 行业动态 更新时间:2024-10-11 09:23:51
PHP如果正在通过URL获取脚本(PHP If Script is being fetched by URL)

我有一个RSS提要,用户将使用它来翻录内容以显示在那里。 但是,我需要检查网站这样做是否可以访问。

它刚刚发生在我身上,我不知道如何检测服务器是否正在读取脚本以及获取的URL是什么。

可能吗?

I have an RSS feed, users will be using it to rip content to display on there site. However I need todo a check that the site doing so has access.

Its just occurred to me that I have no idea in PHP how to detect if the script is being read by a server and what the URL is of the fetch.

Is it possible?

最满意答案

最好的办法是......

为每个rss阅读器提供自己的密钥(甚至可以是登录密码)。 您可以确定没有密钥就无法读取您的RSS。 您只允许从允许列表中的ips读取rss。 检查referer,但这不是一个好主意,因为referer可以伪造,也可以伪造任何HTTP头。

The best approaches for this are...

Give each rss reader it's own key (or maybe even login, password). You'll be sure that nobody can read your RSS without key. You can allow reading rss only from ips from allowed list. Checking referer, but it's not a good idea, because referer could be faked as well as any HTTP header.

更多推荐

本文发布于:2023-07-18 07:17:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1156684.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   URL   PHP   Script   fetched

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!