Simple test of a SOAPClient (with test instance)

Source: Internet
Author: User
Simple test of a SOAPClient (with test instance)
Collect and sort the code by yourself to easily implement online queries for weather and QQ. For reference only, please click it.

  1. /* Generate at Sun, 04 Jan 2009 13:46:27 + 0000
  2. Don't Modify Me!
  3. Cache Name Citys
  4. Key: a5819c80f61198eabf3d3ffceec595de
  5. */
  6. $ Citys = array (
  7. 54511 => 'Beijing ',
  8. 58367 => 'Shanghai ',
  9. 54517 => 'Tianjin ',
  10. 57516 => 'Chongqing ',
  11. 45005 => 'Hong Kong ',
  12. 45011 => 'Macao ',
  13. 50953 => 'Harbin ',
  14. 50745 => 'qiqihar ',
  15. 54094 => 'mudanjiang ',
  16. 50842 => 'daqing ',
  17. 50774 => 'yichun ',
  18. 50884 => 'shuangyashan ',
  19. 50775 => 'hangang ',
  20. 50978 => 'jixi ',
  21. 50873 => 'jiamusi ',
  22. 50971 => 'qitaihe ',
  23. 50468 => 'heihe ',
  24. 50853 => 'suihu ',
  25. 50442 => 'daxinganling ',
  26. 54161 => 'changchun ',
  27. 54172 => 'jilin ',
  28. 54371 => 'baishan ',
  29. 50936 => 'White City ',
  30. 54157 => 'siping ',
  31. 50946 => 'songyuan ',
  32. 54260 => 'liaoyuan ',
  33. 50945 => 'daam ',
  34. 54363 => 'tonghua ',
  35. 54342 => 'Shenyang ',
  36. 54662 => 'Dalian ',
  37. 54453 => 'huludao ',
  38. 54660 => 'lushun ',
  39. 54346 => 'benxi ',
  40. 54353 => 'fushun ',
  41. 54249 => 'tieling ',
  42. 54347 => 'liaoyang ',
  43. 54471 => 'yingkou ',
  44. 54237 => 'fuxin ',
  45. 54324 => 'chaoyang ',
  46. 54337 => 'jinzhou ',
  47. 54497 => 'danton ',
  48. 54339 => 'anshan ',
  49. 53463 => 'huheha ',
  50. 54102 => 'xilinhot ',
  51. 53446 => 'Baotou ',
  52. 54218 => 'Chifeng ',
  53. 50527 => 'hailar ',
  54. 53512 => 'wuhai ',
  55. 53543 => 'erdos ',
  56. 54135 => 'tongliao ',
  57. 53698 => 'shijiazhuang ',
  58. 54534 => 'tangshan ',
  59. 54401 => 'zhangjiakou ',
  60. 54515 => 'langfang ',
  61. 53798 => 'xingtai ',
  62. 53892 => 'handan ',
  63. 54616 => 'cangzhou ',
  64. 54702 => 'hengshui ',
  65. 54423 => 'chengde ',
  66. 54602 => 'baoding ',
  67. 54449 => 'qinhuangdao ',
  68. 57083 => 'zhengzhou ',
  69. 57091 => 'kaifeng ',
  70. 57073 => 'luoyang ',
  71. 57171 => 'pingdingshan ',
  72. 53982 => 'jiaozuo ',
  73. 53990 => 'hebi ',
  74. 53986 => 'xinxiang ',
  75. 53898 => 'anyang ',
  76. 54900 => 'puyang ',
  77. 57089 => 'Xuchang ',
  78. 57186 => 'luohe ',
  79. 57051 => 'Sanmenxia ',
  80. 57178 => 'nanyang ',
  81. 58005 => 'shangqiu ',
  82. 57297 => 'xinyang ',
  83. 57195 => 'zhoukou ',
  84. 57290 => 'zhumadian ',
  85. 54823 => 'jinan ',
  86. 54857 => 'Qingdao ',
  87. 54830 => 'zibo ',
  88. 54774 => 'weihai ',
  89. 54918 => 'qufu ',
  90. 54938 => 'linyi ',
  91. 54765 => 'yantai ',
  92. 58024 => 'zaozhuang ',
  93. 54806 => 'liaocheng ',
  94. 54915 => 'jining ',
  95. 54906 => 'heze ',
  96. 54827 => 'ta ',
  97. 54945 => 'rizhao ',
  98. 54736 => 'dongying ',
  99. 54714 => 'dezhou ',
  100. 54734 => 'binzhou ',
  101. 54828 => 'laiwu ',
  102. 54843 => 'weifang ',
  103. 53772 => 'Taiyuan ',
  104. 53782 => 'yangquan ',
  105. 53976 => 'jincheng ',
  106. 53778 => 'jinzhong ',
  107. 53868 => 'linfen ',
  108. 53959 => 'yuncheng ',
  109. 53882 => 'changzhi ',
  110. 53578 => 'shuozhou ',
  111. 53674 => 'xinzhou ',
  112. 53487 => 'Datong ',
  113. 58238 => 'Nanjing ',
  114. 58357 => 'Suzhou ',
  115. 58356 => 'kunshan ',
  116. 58259 => 'nantong ',
  117. 58377 => 'taicang ',
  118. 58349 => 'wuxian ',
  119. 58027 => 'xuzhou ',
  120. 58346 => 'yixing ',
  121. 58248 => 'zhenjiang ',
  122. 58145 => 'huaian ',
  123. 58352 => 'changshu ',
  124. 58151 => 'yancheng ',
  125. 58246 => 'taizhou ',
  126. 58354 => 'Wuxi ',
  127. 58044 => 'lianyungang ',
  128. 58245 => 'yangzhou ',
  129. 58343 => 'changzhou ',
  130. 58131 => 'suqian ',
  131. 58321 => 'Hefei ',
  132. 58326 => 'chaohu ',
  133. 58221 => 'bengbu ',
  134. 58424 => 'anqing ',
  135. 58311 => 'Liu 'an ',
  136. 58236 => 'chuzhou ',
  137. 58336 => 'maanshan ',
  138. 58203 => 'fuyang ',
  139. 58433 => 'xuancheng ',
  140. 58429 => 'tongling ',
  141. 58116 => 'huaibei ',
  142. 58334 => 'wuhu ',
  143. 58122 => 'Suzhou ',
  144. 58224 => 'huainan ',
  145. 58427 => 'chizhou ',
  146. 57036 => 'xiance ',
  147. 53955 => 'hancheng ',
  148. 57245 => 'ankang ',
  149. 57127 => 'hanzhong ',
  150. 57016 => 'baoji ',
  151. 57048 => 'xianyang ',
  152. 53646 => 'Yulin ',
  153. 57045 => 'weinan ',
  154. 57143 => 'shanglo ',
  155. 53947 => 'tongchuan ',
  156. 53845 => 'yan'an ',
  157. 53614 => 'yinchuan ',
  158. 53817 => 'qingyuan ',
  159. 53704 => 'zhongwei ',
  160. 53518 => 'shizushan ',
  161. 53612 => 'wuzhong ',
  162. 52889 => 'lanzhou ',
  163. 52896 => 'baibai ',
  164. 53829 => 'qingyang ',
  165. 52533 => 'jiuquan ',
  166. 57006 => 'tianshui ',
  167. 52679 => 'wuwei ',
  168. 52652 => 'hangzhou ',
  169. 50741 => 'gannan ',
  170. 52984 => 'linxia ',
  171. 53915 => 'pingliang ',
  172. 52995 => 'dingxi ',
  173. 52675 => 'jinchang ',
  174. 52866 => 'sinning ',
  175. 52754 => 'haibei ',
  176. 52737 => 'haisi ',
  177. 56065 => 'huangnan ',
  178. 56043 => 'guolo ',
  179. 56029 => 'yushu ',
  180. 52875 => 'haidong ',
  181. 52856 => 'Hainan ',
  182. 57494 => 'Wuhan ',
  183. 57461 => 'yichang ',
  184. 57498 => 'huanggang ',
  185. 57447 => 'enshi ',
  186. 57476 => 'jingzhou ',
  187. 57362 => 'shennongjia ',
  188. 57256 => 'shiyan ',
  189. 57590 => 'xianning ',
  190. 57278 => 'xiangfan ',
  191. 57482 => 'xiaogan ',
  192. 57381 => 'suizhou ',
  193. 58407 => 'huangshi ',
  194. 57377 => 'jingmen ',
  195. 57496 => 'ezhou ',
  196. 57679 => 'Changsha ',
  197. 57766 => 'shaoyang ',
  198. 57662 => 'changde ',
  199. 57972 => 'chenzhou ',
  200. 57649 => 'gistar ',
  201. 57780 => 'zhuzhou ',
  202. 57763 => 'loudi ',
  203. 57773 => 'xiangtan ',
  204. 57674 => 'yiyang ',
  205. 57866 => 'yongzhou ',
  206. 57584 => 'yueyang ',
  207. 57872 => 'hengyang ',
  208. 57749 => 'huaihua ',
  209. 57771 => 'shaoshan ',
  210. 57558 => 'zhangjiajie ',
  211. 58457 => 'hangzhou ',
  212. 58450 => 'huzhou ',
  213. 58549 => 'jinhua ',
  214. 58563 => 'ningbo ',
  215. 58646 => 'lishui ',
  216. 58453 => 'shaoxing ',
  217. 58633 => 'quzhou ',
  218. 58452 => 'jiaxing ',
  219. 58660 => 'taizhou ',
  220. 58477 => 'zhoushan ',
  221. 58659 => 'Wenzhou ',
  222. 58606 => 'nanchang ',
  223. 57786 => 'pingxiang ',
  224. 58502 => 'jiujiang ',
  225. 58637 => 'shangrao ',
  226. 58617 => 'Fuzhou ',
  227. 57799 => 'gian ',
  228. 58627 => 'yingtan ',
  229. 57793 => 'yichun ',
  230. 57796 => 'xinyu ',
  231. 58527 => 'jingdezhen ',
  232. 57993 => 'ganzhou ',
  233. 58847 => 'Fuzhou ',
  234. 59134 => 'xiamen ',
  235. 58927 => 'longyan ',
  236. 58834 => 'nanping ',
  237. 58846 => 'ningde ',
  238. 58946 => 'putian ',
  239. 59137 => 'quanzhou ',
  240. 58828 => 'sanming ',
  241. 59126 => 'zhangzhou ',
  242. 57816 => 'guiyang ',
  243. 57806 => 'ance ',
  244. 57609 => 'chishui ',
  245. 57713 => 'zunyi ',
  246. 57741 => 'tongren ',
  247. 56693 => 'liupanshui ',
  248. 57707 => 'Bijie ',
  249. 57825 => 'kyry ',
  250. 57827 => 'duyun ',
  251. 56294 => 'Chengdu ',
  252. 57602 => 'luzhou ',
  253. 57504 => 'neijiang ',
  254. 56571 => 'liangshan ',
  255. 56171 => 'Aba ',
  256. 57313 => 'bazhong ',
  257. 57206 => 'guangyuan ',
  258. 56386 => 'leshan ',
  259. 56196 => 'mianyang ',
  260. 56198 => 'deyang ',
  261. 56666 => 'panzhihua ',
  262. 56287 => 'ya'an ',
  263. 56492 => 'yibin ',
  264. 56396 => 'zigon ',
  265. 56146 => 'ganizhou ',
  266. 57328 => 'dadada ',
  267. 56298 => 'ziyang ',
  268. 57415 => 'guang'an ',
  269. 57405 => 'suining ',
  270. 56391 => 'meishan ',
  271. 57411 => 'nanchong ',
  272. 59287 => 'Guangzhou ',
  273. 59493 => 'Shenzhen ',
  274. 59312 => 'chaozhou ',
  275. 59082 => 'shaoguan ',
  276. 59658 => 'zhanjiang ',
  277. 59298 => 'huizhou ',
  278. 59280 => 'qingyuan ',
  279. 59289 => 'Dongguan ',
  280. 59473 => 'jiangmen ',
  281. 59659 => 'maoming ',
  282. 59278 => 'zhaoqing ',
  283. 59501 => 'tail ',
  284. 59293 => 'heyuan ',
  285. 59315 => 'jieyang ',
  286. 59117 => 'meizhou ',
  287. 59485 => 'zhongshan ',
  288. 59269 => 'diqing ',
  289. 59663 => 'yangjiang ',
  290. 59471 => 'yunfu ',
  291. 59488 => 'Zhuhai ',
  292. 59316 => 'shantou ',
  293. 59431 => 'nanning ',
  294. 57957 => 'guilin ',
  295. 59051 => 'yangshuo ',
  296. 59046 => 'Liuzhou ',
  297. 59265 => 'wuzhou ',
  298. 59453 => 'Yulin ',
  299. 59254 => 'guiping ',
  300. 59065 => 'hezhou ',
  301. 59632 => 'qinzhou ',
  302. 59249 => 'guigang ',
  303. 59635 => 'fangchenggang ',
  304. 59211 => 'baise ',
  305. 59644 => 'beihai ',
  306. 59023 => 'hechi ',
  307. 59242 => 'lailai ',
  308. 59425 => 'chongzu ',
  309. 56778 => 'Kunming ',
  310. 56748 => 'baoshan ',
  311. 56768 => 'chuxiong ',
  312. 56844 => 'dihong ',
  313. 56975 => 'honghe ',
  314. 56951 => 'lincang ',
  315. 56533 => 'nujiang ',
  316. 56783 => 'qujing ',
  317. 56964 => 'simao ',
  318. 56994 => 'wenshan ',
  319. 56875 => 'yuxi ',
  320. 56586 => 'zhaotong ',
  321. 56651 => 'lijiang ',
  322. 56751 => 'Dali ',
  323. 59758 => 'haikou ',
  324. 59948 => 'sanya ',
  325. 59845 => 'bozhou ',
  326. 59757 => 'qiongshan ',
  327. 59941 => 'tosh ',
  328. 59856 => 'wenchang ',
  329. 51463 => 'Urumqi ',
  330. 51076 => 'alty ',
  331. 51628 => 'aksus ',
  332. 51368 => 'changji ',
  333. 52203 => 'hami ',
  334. 51828 => 'hetian ',
  335. 51709 => 'khash ',
  336. 51243 => 'karamay ',
  337. 51356 => 'shihezi ',
  338. 51133 => 'city ',
  339. 51656 => 'kurle ',
  340. 51573 => 'turfan ',
  341. 55591 => 'Lhasa ',
  342. 55437 => 'Ali ',
  343. 56137 => 'changdu ',
  344. 55299 => 'naqu ',
  345. 55578 => 'shigate ',
  346. 55598 => 'shannan ',
  347. 56312 => 'linzhi ',
  348. 58968 => 'Taipei ',
  349. 59554 => 'kaohsiung ',
  350. 17060 => 'Istanbul Istanbul ',
  351. 40754 => 'Tehran TEHRAN ',
  352. 41781 => 'Karachi KARACHI ',
  353. 42182 => 'New delhi new Delhi ',
  354. 43466 => 'colombo Column ',
  355. 47108 => 'Seoul SEOUL ',
  356. 47159 => 'Busan BUSAN ',
  357. 47662 => 'Tokyo TOKYO ',
  358. 48097 => 'yangon Yangon ',
  359. 48454 => 'Bangkok bangok ',
  360. 48647 => 'kuala lumpur kuala lumpur ',
  361. 48820 => 'Hanoi HA noi ',
  362. 96745 => 'Jakarta JAKARTA ',
  363. 10141 => 'Hamburg HAMBURG ',
  364. 10381 => 'Berlin Berlin ',
  365. 10637 => 'frankfurt ',
  366. 11034 => 'Vienna VIENNA ',
  367. 16066 => 'Milan MILANO ',
  368. 16235 => 'Rome Roma ',
  369. 16701 => 'Athens Athens ',
  370. 2484 => 'Stockholm stockhol ',
  371. 27612 => 'Moscow MOSKVA ',
  372. 3334 => 'Manchester MANCHESTER ',
  373. 3779 => 'London LONDON ',
  374. 6240 => 'Amsterdam AMSTERDAM ',
  375. 6451 => 'Brussels brusseles ',
  376. 6660 => 'Zurich ZURICH ',
  377. 6700 => 'Geneva geneve ',
  378. 61291 => 'bamako ',
  379. 63450 => 'Addis ababa addis ababa ',
  380. 63740 => 'Nairobi NAIROBI ',
  381. 65472 => 'accra accra ',
  382. 67341 => 'maputo ',
  383. 68368 => 'Johannesburg JOHANNESBURG ',
  384. 68396 => 'manzini MANZINI ',
  385. 68816 => 'Cape TOWN ',
  386. 71624 => 'Toronto TORONTO ',
  387. 71627 => 'Montreal MONTREAL ',
  388. 71628 => 'Ottawa OTTAWA ',
  389. 71892 => 'Vancouver VANCOUVER ',
  390. 72202 => 'Miami MIAMI ',
  391. 72219 => 'Atlanta Atlantis ',
  392. 72243 => 'Houston HOUSTON ',
  393. 72295 => 'Los Angeles ',
  394. 72386 => 'Las VEGAS ',
  395. 72403 => 'Washington DC ',
  396. 72503 => 'New york new york ',
  397. 72509 => 'Boston BOSTON ',
  398. 72530 => 'Chicago CHICAGO ',
  399. 72793 => 'Seattle SEATTLE ',
  400. 78264 => 'Santiago santiago de cuba ',
  401. 80222 => 'bogota BOGOTA ',
  402. 84628 => 'Lima Lim ',
  403. 85799 => 'Port PUERTO montt ',
  404. 87585 => 'Buenos AIRES buckets ',
  405. 93110 => 'Auckland Auckland ',
  406. 93436 => 'Wellington WELLINGTON ',
  407. 94767 => 'Sydney SYDNEY ',
  408. 94868 => 'Melbourne Melbourne ',
  409. 94926 => 'Canberra canbera ',
  410. 59279 => 'foshan ',
  411. 53753 => 'luliang ',
  412. 51431 => 'irn ');
  413. ?>

  1. Header ('content-type: text/html; charset = utf-8 ');
  2. Require_once 'City. php ';
  3. @ Error_reporting (0 );
  4. If ($ _ POST ['submit '] =' OK ')
  5. {
  6. $ Client = new SoapClient ('http: // www.webxml.com.cn/WebServices/WeatherWebService.asmx? Wsdl ');
  7. $ Code = $ _ POST ['city'];
  8. // $ Code = 'Shenzhen ';
  9. $ Para = array ('thecityname' => $ code );
  10. $ Res = $ client->__ Call ('getweatherbycityname', array ('paramters '=> $ para)-> getWeatherbyCityNameResult-> string;
  11. Echo"
    ";
  12. Echo "city:". $ res [1];
  13. Echo"
    Temperature: ". $ res [5];
  14. Echo"
    Weather: ". $ res [6];
  15. Echo"
    Wind power: ". $ res [7];
  16. Echo"
  17. ";
  18. // $ Qq =$ _ POST ['qqnum'];
  19. $ Qq = '000000 ';
  20. If (! Empty ($ qq ))
  21. {
  22. If (preg_match ('/^ \ d + $/', $ qq ))
  23. {
  24. $ Client = new SoapClient ('http: // www.webxml.com.cn/webservices/qqOnlineWebService.asmx? Wsdl ', array ('Trace' => 1 ));
  25. $ Para = array ('qqcode' => $ qq );
  26. $ Res = $ client->__ Call ('qqcheckonline', array ('paramters '=> $ para)-> qqCheckOnlineResult;
  27. Echo $ qq. 'current '. ($ res = 'y '? 'Line': 'offline ');
  28. }
  29. Else
  30. {
  31. Echo'Incorrect QQ number';
  32. }
  33. }
  34. }
  35. ?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.