您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

哪位高手帮小弟我改编用curl调用web service

2024/3/10 13:01:00发布119次查看
谁帮我改编用curl调用web service
soap_defencoding = 'utf-8';
 $s->decode_utf8 = false;
  $result=$s->call('userinfo',array('user'=> urldecode($_get['username'])));
if (!$err=$s->geterror()) {  
  $list=explode(;,$result[userinforesult]);
  array_pop($list);
  } else {  
  echo '
';  
  }
 ?>
service1.asmx这个web service里有个userinfo函数,要把参数传进这个函数,返回结果集
本来好好的,但是虚拟主机不给开soap拓展,那就不用白费力气了,,现在怎么弄curl改写
------解决方案--------------------
------解决方案--------------------
$url=https://xxx/xml;
$ch = curl_init ($url);
$headers = array(
post .https://cxxx/integration/xml. http/1.0,
content-type: text/xml;charset=\utf-8\,
accept: text/xml,
content-length: .strlen($xmlcontent),
);
$ch = curl_init();
curl_setopt($ch, curlopt_url,$url);
curl_setopt($ch, curlopt_returntransfer, 1);
curl_setopt($ch, curlopt_timeout, 60);
curl_setopt($ch, curlopt_httpheader, $headers);
curl_setopt($ch,curlopt_ssl_verifypeer,0);
// apply the xml to our curl call
curl_setopt($ch, curlopt_post, 1);
curl_setopt($ch, curlopt_postfields, $xmlcontent);
$data = curl_exec($ch);
if (curl_errno($ch)) {
die('会议信息出错,有可能会议还未开始!');
exit;
} else {
//var_dump($data);
curl_close($ch);
}
//
$succes='';
$ciurl='';
$token='';
$xml = simplexml_load_string($data);
$ciurl = $xml->body->ciurl;
$token = $xml->body->token;
var_dump( $xml );
------解决方案--------------------
楼主估计想结贴结疯拉。呵呵
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product