最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php 接收与发送xml文件
时间:2022-07-02 10:10:57 编辑:袖梨 来源:一聚教程网
$url = http://*des*t_*url;
$header[] = "Content-type: text/xml";//定义content-type为xml
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_data);
$response = curl_exec($ch);
if(curl_errno($ch))
{
print curl_error($ch);
}
curl_close($ch);
fputs($fp, "POST $path HTTP/1.0rn");
fputs($fp, "Host: $serverrn");
fputs($fp, "Content-Type: text/xmlrn");
fputs($fp, "Content-Length: $contentLengthrn");
fputs($fp, "Connection: closern");
fputs($fp, "rn"); // all headers sent
fputs($fp, $xml_data);
$result = '';
while (!feof($fp)) {
$result .= fgets($fp, 128);
}
return $result;
相关文章
- 宗门志炼丹方法及建筑升级介绍说明 10-04
- 多洛可小镇河谷商人库玛桑位置一览 10-04
- 毁灭战士黑暗时代赫贝斯火门打开方法 10-04
- 宗门志突破金丹境界方法介绍说明 10-04
- 多洛可小镇狙击发射器素材获取攻略分享 10-04
- 毁灭战士黑暗时代装备升级方法分享 10-04