国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > 建站經驗 > 正文

PHP使用NuSOAP調用Web服務的方法

2024-04-25 20:39:37
字體:
來源:轉載
供稿:網友

本文實例講述了PHP使用NuSOAP調用Web服務的方法。分享給大家供大家參考。具體如下:

Steps:

1. Download nusoap library from internet.

2. Pass parameter list in your $client->call and enjoy.

<?php

require_once('./lib/nusoap.php');

$client = new soapclientnusoap('http://www.devtrackn.com/webservice/server.php');

$err = $client->getError();

if ($err) {

// Display the error

echo '<p><b>Constructor error: ' . $err . '</b></p>';

// At this point, you know the call that follows will fail

}

////////////////////////////////////////////////////////

////////////////////////////////////////////////////////

// update_location method parameter

$param = array(

'device_number' => '9910948357',

'latitude' => '40.727757',

'longitude' => '-73.984366',

'battery_status' => '30'

);

// user_action method parameter

$param2 = array(

'device_number' => '27ab2026da5213ebd6c95e5fbe50965bdfaddf4b',

'latitude' => '40.727757',

'longitude' => '-73.984366',

'user_action' => 'Meeting_Test'

);

// sos method parameter

$param3 = array(

'device_number' => '9910948357',

'latitude' => '40.727757',

'longitude' => '-73.984366',

);

//$result = $client->call('update_location', $param);

//$result = $client->call('user_action', $param2);

//$result = $client->call('sos', $param3);

$result = $client->call('user_entity_status', array('device_number' => '27ab2026da5213ebd6c95e5fbe50965bdfaddf4b'));

////////////////////////////////////////////////////////

////////////////////////////////////////////////////////

// Check for a fault

if ($client->fault) {

echo '<p><b>Fault: ';

print_r($result);

echo '</b></p>';

} else {

// Check for errors

$err = $client->getError();

if ($err) {

// Display the error

echo '<p><b>Error: ' . $err . '</b></p>';

} else {

// Display the result

echo "<pre>";

print_r($result);

echo "</pre>";

}

}

echo '<h2>Request</h2>';

echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';

echo '<h2>Response</h2>';

echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';

/*

// Display the debug messages

echo '<h2>Debug</h2>';

echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';

*/

?>

希望本文所述對大家的php程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 永年县| 新干县| 仙游县| 大厂| 巍山| 宝坻区| 岳阳市| 抚顺市| 平罗县| 龙州县| 乐亭县| 卢龙县| 凤翔县| 湛江市| 南平市| 望奎县| 红桥区| 剑阁县| 扎兰屯市| 汉中市| 台山市| 海原县| 淮安市| 涪陵区| 修武县| 潼关县| 台北县| 青海省| 右玉县| 金坛市| 梧州市| 新田县| 富阳市| 龙陵县| 原阳县| 民丰县| 洪洞县| 连江县| 红桥区| 澄城县| 连平县|