如何阻止或卷曲的file_get_contents卷曲、file_get_contents

2023-09-02 01:06:54 作者:我心悸我姓季

我怎么能允许别人使用或卷曲的file_get_contents让我的网页的html? 例如: 我的域名是:

how can i not allow someone to use curl or file_get_contents to get my page html? for example: my domain is:

www.domain.com

有人PHP页面:

someone php page:

<?php
$info = file_get_contents('http://www.domain.com/theinfo.php');
?>

我可以尝试通过用户代理,但它不是正确的方式进行检查。 什么是检查当有人试图让网页内容的最好方式? 我建包含的信息很多人会尝试将其复制到他们的网站,它可以让我的服务器过载。

i can try to check it by user agent but its not the right way. what is the best way to check when someone is trying to get the page content? what i built contains information that many will try to copy it to they websites and it can make my server overload.

推荐答案

如果你关心的人,而不是一个特定的IP或域名,把你的内容,你应该实现某种形式的注册过程中为您的网站。使用Apache过滤很可能会导致更多的问题比它的价值。你应该问自己,如果你是把互联网上的东西实际上并不意味着每个人与机器在那里做,因为他们请,应该无论是LOGIN保护或不能上因特网。

If you are concerned about anyone, not a specific IP or domain, taking your content, you should implement some kind of registration process for your site. Using Apache to filter will probably cause more problems than it is worth. You should ask yourself if what you are putting on the internet is not actually meant for every man and machine out there to do as they please, it should either be login protected or not on the internet.

下面是一个非常简单的使用PHP库实现一个登录名和/或登记制度: https://github.com/panique/php-login

Here is a very simple to use PHP library for implementing a login and/or registration system: https://github.com/panique/php-login