易截截图软件、单文件、免安装、纯绿色、仅160KB

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;


相关文档:

php小笔记


<!--
/* 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:"\@宋体" ......

PHP杂记

 preg_replace -- 执行正则表达式的搜索和替换
array_push --  将一个或多个单元压入数组的末尾(入栈)
preg_match -- 进行正则表达式匹配
exif_imagetype($file) ---图像类型;
echo "<SCRIPT LANGUAGE='JavaScript'>alert('得到');history.back();</SCRIPT>";
exit;
date_defaul ......

PHP中的ereg()与eregi()函数的不同


ereg()
字符串比对解析。
语法: int ereg(string pattern, string string, array [regs]);
返回值: 整数/数组
函数种类: 资料处理
内容说明
本函数以 pattern 的规则来解析比对字符串 string。比对结果返回的值放在数组参数 regs 之中,regs[0] 内容就是原字符串 string、regs[1] 为第一个合乎规则的字符串、regs ......

LINUX下 httpd.conf my.cnf php.ini的位置

 
默认:
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 JSON


JSON 是一项旨在允许中间件创建使用 JavaScript 固有格式的对象的协议。它最强大的属性是它是一种轻量级协议。简单处理 RSS 聚合或 recipe 列表时,您不需要在 JavaScript 中使用 XML 的全部功能。不需要验证格式或确保严格的数据键入。
编码和解码
有两个函数用于 JSON:encode 和 decode。第一个函数将把任意类型的数 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号