php接受xml和发送(post)xml
接收xml:
$xml = file_get_contents('php://input');
发送(post):
$xml_data = <xml>...</xml>";
$url = http://dest_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);
或者:
$fp = fsockopen($server, 80);
fputs($fp, "POST $path HTTP/1.0\r\n");
fputs($fp, "Host: $server\r\n");
fputs($fp, "Content-Type: text/xml\r\n");
fputs($fp, "Content-Length: $contentLength\r\n");
fputs($fp, "Connection: close\r\n");
fputs($fp, "\r\n"); // all headers sent
fputs($fp, $xml_data);
$result = '';
while (!feof($fp)) {
$result .= fgets($fp, 128);
}
return $result;
相关文档:
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体" ......
preg_replace -- 执行正则表达式的搜索和替换
array_push -- 将一个或多个单元压入数组的末尾(入栈)
preg_match -- 进行正则表达式匹配
exif_imagetype($file) ---图像类型;
echo "<SCRIPT LANGUAGE='JavaScript'>alert('得到');history.back();</SCRIPT>";
exit;
date_defaul ......
默认:
httpd.conf 在/etc/httpd/conf
my.cnf 在/etc
php.ini 在/usr/local/lib
在Unix 上,php.ini文件缺省放在/usr/local/lib上面,因为缺省的存放路径是<install-path>
/lib,但是可以在编译的时候使用--with-config-file-path参数来修改php.ini的存放位置,例如你可以使用--with-
config-file-path ......
<?php
if(empty($_GET[submit]))
{
?>
<form enctype="multipart/form-data" action="<?php $_SERVER['PHP_SELF']?>?submit=1" method="post">
<input name="filename" type="file">
<input type="submit" value="确定上传">
</form>
<?php
}
else{
......
康盛博客提供原创PHP教程,如果有兴趣请加群:6430092.欲加从速!!!本来在CSDN创建博客是想把自己的文章让更多的人看到,如果能够为大家带来帮助那是更好不过的事了。本教程只是本人的学习笔记,切不可真拿来当php教程来读只可作为参考!后来才发现,转载文章真的太费时间,所以就转载个目录吧,本文不会更新,所以如果有 ......