12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- namespace app\controller;
- use app\BaseController;
- use app\common\array2xml;
- use think\facade\Db;
- use think\facade\Cache;
- class Index extends BaseController
- {
- public function index()
- {
- phpinfo();
- }
- public function hello($name = 'ThinkPHP6')
- {
- return 'hello,' . $name;
- }
- public function getReport()
- {
- libxml_disable_entity_loader(false);
- // $opts = array(
- // 'ssl' => array(
- // 'verify_peer' => false
- // ),
- // 'https' => array(
- // 'curl_verify_ssl_peer' => false,
- // 'curl_verify_ssl_host' => false
- // )
- // );
- // $streamContext = stream_context_create($opts);
- // $client = new \SoapClient("http://112.103.134.89:10020/server.php?wsdl",
- // array(
- // 'stream_context' => $streamContext
- // ));
- // $client = new \SoapClient("http://112.103.134.89:10020/server.php?wsdl");
- use_soap_error_handler(false);
- $requestUrl = "http://112.103.134.89:10020/server.php?wsdl";
- $options = array("trace" => 1, "cache_wsdl" => WSDL_CACHE_NONE,"exception" => 0,'location'=>'http://112.103.134.89:10020/server.php?wsdl','uri'=>'http://tempuri.org/');
- $client = new \SoapClient($requestUrl, $options);
- $data = [
- 'Barcode'=>'12203310010001'
- ]; //请求参数
- $a2x = new array2xml();
- $data = $a2x->toXml($data); //参数转xml
- try{
- $result = $client->getDiAnData($data); //请求获取接口
- }catch(\SoapFault $e){
- return $e->getMessage();
- }
- var_dump(htmlspecialchars($result));die;
- $obj = simplexml_load_string($result,"SimpleXMLElement", LIBXML_NOCDATA);
- $ins = json_encode($obj);
- $obj = json_decode($ins,true);
- var_dump($obj);die;
- }
- public function aa()
- {
- $conn = mysqli_connect('localhost','root','');
- $a = mysqli_select_db($conn,'tijianzhongxin');
- $sql = "select * from dianApiInfo where Barcode='12203020024872'";
- $result = mysqli_query($conn, $sql);
- $info = mysqli_fetch_row($result);
- if(!empty($info))
- {
- $return = [
- 'xml'=>$info[1],
- 'patientId'=>$info[2],
- 'barCode'=>$info[3]
- ];
- $a2x = new array2xml();
- $r = $a2x->toXml($return);
- return $r;
- }else{
- return '';
- }
- }
- }
|