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

首頁 > 開發 > PHP > 正文

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

2024-05-04 23:37:55
字體:
來源:轉載
供稿:網友

這篇文章主要介紹了PHP使用NuSOAP調用Web服務的方法,涉及php實現web服務的相關技巧,具有一定參考借鑒價值,需要的朋友可以參考下

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

Steps:

1. Download nusoap library from internet.

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

  1. <?php 
  2. require_once('./lib/nusoap.php'); 
  3. $client = new soapclientnusoap('http://www.devtrackn.com/webservice/server.php'); 
  4. $err = $client->getError(); 
  5. if ($err) { 
  6. // Display the error 
  7. echo '<p><b>Constructor error: ' . $err . '</b></p>'
  8. // At this point, you know the call that follows will fail 
  9. //////////////////////////////////////////////////////// 
  10. //////////////////////////////////////////////////////// 
  11. // update_location method parameter 
  12. $param = array
  13. 'device_number' => '9910948357'
  14. 'latitude' => '40.727757'
  15. 'longitude' => '-73.984366'
  16. 'battery_status' => '30' 
  17. ); 
  18. // user_action method parameter 
  19. $param2 = array
  20. 'device_number' => '27ab2026da5213ebd6c95e5fbe50965bdfaddf4b'
  21. 'latitude' => '40.727757'
  22. 'longitude' => '-73.984366'
  23. 'user_action' => 'Meeting_Test' 
  24. ); 
  25. // sos method parameter 
  26. $param3 = array
  27. 'device_number' => '9910948357'
  28. 'latitude' => '40.727757'
  29. 'longitude' => '-73.984366'
  30. ); 
  31. //$result = $client->call('update_location', $param); 
  32. //$result = $client->call('user_action', $param2); 
  33. //$result = $client->call('sos', $param3); 
  34. $result = $client->call('user_entity_status'array('device_number' => '27ab2026da5213ebd6c95e5fbe50965bdfaddf4b')); 
  35. //////////////////////////////////////////////////////// 
  36. //////////////////////////////////////////////////////// 
  37. // Check for a fault 
  38. if ($client->fault) { 
  39. echo '<p><b>Fault: '
  40. print_r($result); 
  41. echo '</b></p>'
  42. else { 
  43. // Check for errors 
  44. $err = $client->getError(); 
  45. if ($err) { 
  46. // Display the error 
  47. echo '<p><b>Error: ' . $err . '</b></p>'
  48. else { 
  49. // Display the result 
  50. echo "<pre>"
  51. print_r($result); 
  52. echo "</pre>"
  53. echo '<h2>Request</h2>'
  54. echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>'
  55. echo '<h2>Response</h2>'
  56. echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>'
  57. /* 
  58. // Display the debug messages 
  59. echo '<h2>Debug</h2>'; 
  60. echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>'; 
  61. */ 
  62. ?> 


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


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 和龙市| 富平县| 砚山县| 双流县| 阿鲁科尔沁旗| 白朗县| 华阴市| 神木县| 蒙山县| 明光市| 汝阳县| 通辽市| SHOW| 崇左市| 溧水县| 攀枝花市| 彭泽县| 乌鲁木齐市| 丰都县| 陇西县| 乐昌市| 平定县| 罗田县| 峨眉山市| 阜新市| 和林格尔县| 沁阳市| 四平市| 绥棱县| 齐齐哈尔市| 伊川县| 突泉县| 湄潭县| 东海县| 东乌珠穆沁旗| 探索| 壤塘县| 唐海县| 衡东县| 历史| 高尔夫|