【发布时间】:2016-05-02 16:03:03
【问题描述】:
假设我们有 File /path/aFile.php,它对域 example.com 进行 curl GET 调用(example.com 是本地网络之外的域)。
$url="https://example.com/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
$result=curl_exec($ch);
print $result;
example.com 的主机会看到 GET curl 请求来自文件“aFile.php”吗? 他能否看到更多信息,例如“/path/aFile.php”等文件的目录
显示什么信息?我尝试使用 Charles 应用程序和篡改数据,并在 GET 请求中显示:
GET /path/aFile.php HTTP/1.1
如果确实将此类信息传递给 GET 请求的接收者,是否可以不显示所有这些信息?
我在 curl 请求中添加了以下标头,但我仍然得到相同的信息。
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Host: example.com",
"Accept-Encoding: gzip",
"Accept: application/json",
"Referer: $hosturl_stripped",
"User-Agent: Mozilla/4.0 Firefox/46.0",
"Accept-Language: en-US,en;q=0.5",
"X-Requested-With: XMLHttpRequest",
));
【问题讨论】:
-
你可以 curl 一个 php 文件,
print_r($_SERVER)并找出答案。不,除非你这样做,否则它是不可见的。你问来干什么?这可能更相关。 -
我不想在本地环境中测试它,因为我认为它的行为可能会有所不同。我不希望有人知道我在他们的网站上使用的文件的文件名或文件夹结构。
-
I assume it could behave differently不会,但根本不尝试有点懒惰。I do not want them to know the name of the file+downloads/scrapes- 仅此一项就好像你在做一些不值得任何帮助的事情。
标签: php curl get request-headers