国产探花免费观看_亚洲丰满少妇自慰呻吟_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程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 原阳县| 镇江市| 根河市| 兴文县| 城步| 桐乡市| 合江县| 台北市| 湘潭县| 南岸区| 班玛县| 独山县| 新竹县| 股票| 老河口市| 曲靖市| 都昌县| 杭锦后旗| 昌图县| 和龙市| 西吉县| 兰坪| 宜章县| 新野县| 内丘县| 江西省| 邛崃市| 搜索| 濉溪县| 大埔县| 和政县| 林口县| 庆元县| 翁源县| 新源县| 黄陵县| 京山县| 平定县| 蓬溪县| 华安县| 惠水县|