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


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 林甸县| 耿马| 什邡市| 霞浦县| 桦南县| 渑池县| 华蓥市| 丰县| 雷波县| 濮阳市| 三都| 南平市| 榆树市| 富平县| 望谟县| 峨眉山市| 会理县| 夏邑县| 孙吴县| 佛教| 锡林浩特市| 沙雅县| 博爱县| 广元市| 安多县| 政和县| 桐梓县| 阿克苏市| 台山市| 海原县| 武乡县| 寿宁县| 富裕县| 普陀区| 温州市| 金昌市| 苗栗市| 资中县| 昌图县| 垦利县| 富顺县|