【发布时间】:2016-09-13 16:00:43
【问题描述】:
我有一个应用程序可以生成几个 apache 原始文件,如下所示,我如何将所有这些文件用作对 php 的请求?据我所知,我们可以像header("Location: http://www.example.com/"); 一样单独调用它们,但是我们如何通过这样的一个命令调用它们? (只是举例)
<?php
header("http://example.com/test.php
POST test.php HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:48.0) Gecko/20100101 Firefox/48.0
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Referer: http://example.com/test/
Content-Length: 87
Cookie: __cfduid=somevalue;
Connection: keep-alive
a=1&b=2");
?>
我想将它完全发送到我的服务器,可以吗?
【问题讨论】:
-
PHP header 函数设置 apache 返回给客户端的 response 标头。问题中的标头是客户端发送给 apache 的 request 标头。
-
好的,在一个命令中只使用地址和引用以及 cookie 和参数呢?
-
不能设置referer或者让浏览器通过headers提交POST请求。详情请看我的回答。