在php里面怎么提交一个post请求,我要请求一个网址,传参数进去。他会返回一个xml格式的文件结果。在php里面怎么post。
解决方案 »
- 为什么php导入html中的代码,javascript不能对其产生作用
- XP下 配置Aapche下PHP环境总是不成功,高手请进指教!
- php中如何得到windows客户端当前用户名和域名???急急急!!!
- $order->id|string_format:"%06d"出错
- 请教高手,如何将是否登录封装成函数,然后使用。。。
- 请问一个多级跳转菜单的问题
- 用ip访问css丢失
- 如何把当前的日期和时间传到DateTime字段中去
- Zend问题,在线等候.
- 如何获得CHECKBOX未选中的值?
- php如何使用header直接下载图片?
- MYSQL 表出问题Table 'XX' is marked as crashed and should be repaired
{
$f='';
$data='';
foreach($p as $k=>$v)
{
$data.=$f.$k.'='.urlencode($v);
$f='&';
}
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$res = curl_exec($curl);
if(curl_errno($curl))
{
echo 'Curl error: ' . curl_error($curl);
}
curl_close($curl);
return $res;
}$x=_xpost('http://abc.com/aa.php',array( 'username'=>$uname,
));
<?xml version="1.0" encoding="UTF-8" ?>
<result>
<response>1</response>
</result>
我怎么获取<response>之间的1这个值?
preg_match('/<response>(.*?)<\/response>/s',$xml,$m);
echo $m[1];
xpath,或者直接操作dom都行。