网站首页 > 知识剖析 正文
<?php
require_once('lib/nusoap.php' );
$client = new nusoap_client("http://10.10.1.63:8888/cmtsmain/services/WebServiceServer?wsdl", 'wsdl' );
$client->soap_defencoding = 'utf-8' ;
$client->decode_utf8 = false ;
$client->xml_encoding = 'utf-8' ;
$err = $client ->getError();
if ($err ) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>' ;
echo '<h2>Debug</h2><pre>' . htmlspecialchars( $client->getDebug(), ENT_QUOTES) . '</pre>' ;
exit();
}
$pAppCode = '123' ;
$pCinemaID = '1561' ;
$secretKey = '1234567' ;
$pVerifyInfo = strtolower(md5(strtolower($pAppCode .$pCinemaID .$secretKey )));
//需要截取从第8位开始截取,取 16位的字符
$params = array (
'pAppCode' => "123" ,
'pCinemaID' => '1561',
'pVerifyInfo' => '7d1daac20de86ec2'
);
$result = $client ->call('getCinema', $params);
var_dump($result);
//如上的var_dump() 我原本期望的输出含有xml格式是:
<GetCinemaResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ResultCode>0</ResultCode>
<Cinemas>
<Cinema>
<PlaceNo>54</PlaceNo>
<PlaceName>阳光影院</PlaceName>
<CityNo></CityNo>
<CreateDate></CreateDate>
</Cinema>
<Cinema>
<PlaceNo>123</PlaceNo>
<PlaceName>莲花影院</PlaceName>
<CityNo>27</CityNo>
<CreateDate></CreateDate>
</Cinema>
<Cinema>
<PlaceNo>123</PlaceNo>
<PlaceName>莲花影院</PlaceName>
<CityNo>27</CityNo>
<CreateDate></CreateDate>
</Cinema>
<Cinema>
<PlaceNo>1561</PlaceNo>
<PlaceName>中心地面</PlaceName>
<CityNo>69</CityNo>
<CreateDate></CreateDate>
</Cinema>
</Cinemas>
</GetCinemaResult>
但是浏览器一直输出:
array(1) { ["return"]=> string(649) "054阳光影院123莲花影院27123莲花影院271561中心地面69" } 眼看着649字符,却看不到xml标签,后来才想到var_dump出来得的xml标签都被浏览器给解析了。
if ($client ->fault) {
echo '<h2>Fault (Expect - The request contains an invalid SOAP body)</h2><pre>'; print_r($result); echo '</pre>';
} else {
$err = $client ->getError();
if ($err ) {
echo '<h2>Error</h2><pre>' . $err . '</pre>' ;
} else {
echo '<h2>Result</h2><pre>'; print_r( $result); echo '</pre>';
}
}
echo '<h2>Request</h2><pre>' . htmlspecialchars( $client->request, ENT_QUOTES) . '</pre>' ;
echo '<h2>Response</h2><pre>' . htmlspecialchars( $client->response, ENT_QUOTES) . '</pre>' ;
echo '<h2>Debug</h2><pre>' . htmlspecialchars( $client->getDebug(), ENT_QUOTES) . '</pre>' ;
猜你喜欢
- 2024-11-11 详解如何防止SQL注入:应对方案与优缺点分析
- 2024-11-11 XSS注入我也不怕不怕啦--PHP从框架层面屏蔽XSS的思考和实践
- 2024-11-11 挖0day漏洞原来如此简单,我的黑客朋友手把手教你
- 2024-11-11 备战金九银十,2020最新大厂PHP面试题(附答案)
- 2024-11-11 dede后台发布文章的时候显示标题不能为空?
- 2024-11-11 PHP漏洞之-Session劫持 php session机制
- 2024-11-11 php特殊字符处理 php 特殊字符自动转义
- 2024-11-11 Java面试260题(2020年版,3-5年面试题重点突破)(二)
- 2024-11-11 2020最新大厂PHP面试题(附答案) php面试官应该问些什么
- 2024-11-11 反射型 XSS 攻击实战 xss反射性攻击
- 最近发表
- 标签列表
-
- xml (46)
- css animation (57)
- array_slice (60)
- htmlspecialchars (54)
- position: absolute (54)
- datediff函数 (47)
- array_pop (49)
- jsmap (52)
- toggleclass (43)
- console.time (63)
- .sql (41)
- ahref (40)
- js json.parse (59)
- html复选框 (60)
- css 透明 (44)
- css 颜色 (47)
- php replace (41)
- css nth-child (48)
- min-height (40)
- xml schema (44)
- css 最后一个元素 (46)
- location.origin (44)
- table border (49)
- html tr (40)
- video controls (49)