我想更改 php 中的 xml 值但不要更改....
<?php
$url = "http://192.168.1.103:8080/ew.xml";
$xml = '<?xml version="1.0" ?>
<DDCConfig:getValue xmlns:DDCConfig="urn:SMUDDCConfiguration">
<DDCConfig:Network>
<DDCConfig:LocalIP>192.168.103.223</DDCConfig:LocalIP>
<DDCConfig:GlobalIP>168.188.127.123</DDCConfig:GlobalIP>
<DDCConfig:RootBridge>Yes</DDCConfig:RootBridge>
</DDCConfig:Network>
</DDCConfig:getValue>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_USERPWD, "lmk:alrud89");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_URL, "$url");
curl_setopt($ch, CURLOPT_PORT, 8080);
curl_setopt($ch, CURLOPT_PUT, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,array($xml));
$http_result = curl_exec($ch);
if($http_result){
echo $http_result;
}else{
echo curl_error($ch);
}
curl_close($ch);
?>
错误信息是
* 即将 connect() 到 192.168.1.103 端口 8080 (#0) * 正在尝试 192.168.1.103...
* 已连接
* 服务器身份验证使用 Basic 和用户 'lmk'
> PUT /ew.xml HTTP/1.1
> 授权:基本 bG1rOmFscnVkODk =
> Host: 192.168.1.103:8080 Accept: //
Transfer-Encoding: chunked
> Expect: 100-continue
< HTTP/1.1 401 Unauthorized
< Content-Length: 0
<
> WWW-Authenticate: Digest qop="auth", realm ="mydomain.com", nonce="1366254379"
* 发送结束前的 HTTP 错误,停止发送
* 关闭连接 #0
问题和解决方案是什么?