【发布时间】:2018-09-22 04:25:57
【问题描述】:
我正在使用 REQUEST.PHP 在下面的 PHP 代码的上下文中,addHeader 是否附加到标题或覆盖它,即或者我应该将 addHeader 行合并为一行?也许是我,但我在手册中找不到明确的答案。我需要发送标题中的所有信息。
require 'HTTP/Request.php';
// <snip>
$r = new HTTP_Request($dest_url) or die("$dest_url: $php_errormsg");
$r->setMethod(HTTP_REQUEST_METHOD_POST);
$r->addHeader('Content-Type', 'text/xml');
$r->addHeader("Authorization: Basic:" . $authheader, 'text/xml');
$r->addRawPostData($packet);
$res = $r->sendRequest() or die("sendRequest:". $php_errormsg);
if ($r->getResponseCode() == 200) {
header('Content-Type: text/xml');
}
等等
【问题讨论】:
-
您有文档链接吗?
-
如果它只允许您一次添加一个标题,我认为它必须追加而不是替换很明显。不然怎么设置多个header?
-
这是 PEAR HTTP 类吗?
标签: php xml httprequest