自己收集整理的代码,简单的实现天气及QQ在线查询。仅作参考,欢迎拍砖。
-
/*Generate at Sun, 04 Jan 2009 13:46:27 +0000
- Don't Modify Me!
- Cache Name Citys
- key:a5819c80f61198eabf3d3ffceec595de
- */
- $Citys=array (
- 54511 => '北京 ',
- 58367 => '上海 ',
- 54517 => '天津 ',
- 57516 => '重庆 ',
- 45005 => '香港 ',
- 45011 => '澳门 ',
- 50953 => '哈尔滨 ',
- 50745 => '齐齐哈尔 ',
- 54094 => '牡丹江 ',
- 50842 => '大庆 ',
- 50774 => '伊春 ',
- 50884 => '双鸭山 ',
- 50775 => '鹤岗 ',
- 50978 => '鸡西 ',
- 50873 => '佳木斯 ',
- 50971 => '七台河 ',
- 50468 => '黑河 ',
- 50853 => '绥化 ',
- 50442 => '大兴安岭 ',
- 54161 => '长春 ',
- 54172 => '吉林 ',
- 54371 => '白山 ',
- 50936 => '白城 ',
- 54157 => '四平 ',
- 50946 => '松原 ',
- 54260 => '辽源 ',
- 50945 => '大安 ',
- 54363 => '通化 ',
- 54342 => '沈阳 ',
- 54662 => '大连 ',
- 54453 => '葫芦岛 ',
- 54660 => '旅顺 ',
- 54346 => '本溪 ',
- 54353 => '抚顺 ',
- 54249 => '铁岭 ',
- 54347 => '辽阳 ',
- 54471 => '营口 ',
- 54237 => '阜新 ',
- 54324 => '朝阳 ',
- 54337 => '锦州 ',
- 54497 => '丹东 ',
- 54339 => '鞍山 ',
- 53463 => '呼和浩特 ',
- 54102 => '锡林浩特 ',
- 53446 => '包头 ',
- 54218 => '赤峰 ',
- 50527 => '海拉尔 ',
- 53512 => '乌海 ',
- 53543 => '鄂尔多斯 ',
- 54135 => '通辽 ',
- 53698 => '石家庄 ',
- 54534 => '唐山 ',
- 54401 => '张家口 ',
- 54515 => '廊坊 ',
- 53798 => '邢台 ',
- 53892 => '邯郸 ',
- 54616 => '沧州 ',
- 54702 => '衡水 ',
- 54423 => '承德 ',
- 54602 => '保定 ',
- 54449 => '秦皇岛 ',
- 57083 => '郑州 ',
- 57091 => '开封 ',
- 57073 => '洛阳 ',
- 57171 => '平顶山 ',
- 53982 => '焦作 ',
- 53990 => '鹤壁 ',
- 53986 => '新乡 ',
- 53898 => '安阳 ',
- 54900 => '濮阳 ',
- 57089 => '许昌 ',
- 57186 => '漯河 ',
- 57051 => '三门峡 ',
- 57178 => '南阳 ',
- 58005 => '商丘 ',
- 57297 => '信阳 ',
- 57195 => '周口 ',
- 57290 => '驻马店 ',
- 54823 => '济南 ',
- 54857 => '青岛 ',
- 54830 => '淄博 ',
- 54774 => '威海 ',
- 54918 => '曲阜 ',
- 54938 => '临沂 ',
- 54765 => '烟台 ',
- 58024 => '枣庄 ',
- 54806 => '聊城 ',
- 54915 => '济宁 ',
- 54906 => '菏泽 ',
- 54827 => '泰安 ',
- 54945 => '日照 ',
- 54736 => '东营 ',
- 54714 => '德州 ',
- 54734 => '滨州 ',
- 54828 => '莱芜 ',
- 54843 => '潍坊 ',
- 53772 => '太原 ',
- 53782 => '阳泉 ',
- 53976 => '晋城 ',
- 53778 => '晋中 ',
- 53868 => '临汾 ',
- 53959 => '运城 ',
- 53882 => '长治 ',
- 53578 => '朔州 ',
- 53674 => '忻州 ',
- 53487 => '大同 ',
- 58238 => '南京 ',
- 58357 => '苏州 ',
- 58356 => '昆山 ',
- 58259 => '南通 ',
- 58377 => '太仓 ',
- 58349 => '吴县 ',
- 58027 => '徐州 ',
- 58346 => '宜兴 ',
- 58248 => '镇江 ',
- 58145 => '淮安 ',
- 58352 => '常熟 ',
- 58151 => '盐城 ',
- 58246 => '泰州 ',
- 58354 => '无锡 ',
- 58044 => '连云港 ',
- 58245 => '扬州 ',
- 58343 => '常州 ',
- 58131 => '宿迁 ',
- 58321 => '合肥 ',
- 58326 => '巢湖 ',
- 58221 => '蚌埠 ',
- 58424 => '安庆 ',
- 58311 => '六安 ',
- 58236 => '滁州 ',
- 58336 => '马鞍山 ',
- 58203 => '阜阳 ',
- 58433 => '宣城 ',
- 58429 => '铜陵 ',
- 58116 => '淮北 ',
- 58334 => '芜湖 ',
- 58122 => '宿州 ',
- 58224 => '淮南 ',
- 58427 => '池州 ',
- 57036 => '西安 ',
- 53955 => '韩城 ',
- 57245 => '安康 ',
- 57127 => '汉中 ',
- 57016 => '宝鸡 ',
- 57048 => '咸阳 ',
- 53646 => '榆林 ',
- 57045 => '渭南 ',
- 57143 => '商洛 ',
- 53947 => '铜川 ',
- 53845 => '延安 ',
- 53614 => '银川 ',
- 53817 => '固原 ',
- 53704 => '中卫 ',
- 53518 => '石嘴山 ',
- 53612 => '吴忠 ',
- 52889 => '兰州 ',
- 52896 => '白银 ',
- 53829 => '庆阳 ',
- 52533 => '酒泉 ',
- 57006 => '天水 ',
- 52679 => '武威 ',
- 52652 => '张掖 ',
- 50741 => '甘南 ',
- 52984 => '临夏 ',
- 53915 => '平凉 ',
- 52995 => '定西 ',
- 52675 => '金昌 ',
- 52866 => '西宁 ',
- 52754 => '海北 ',
- 52737 => '海西 ',
- 56065 => '黄南 ',
- 56043 => '果洛 ',
- 56029 => '玉树 ',
- 52875 => '海东 ',
- 52856 => '海南 ',
- 57494 => '武汉 ',
- 57461 => '宜昌 ',
- 57498 => '黄冈 ',
- 57447 => '恩施 ',
- 57476 => '荆州 ',
- 57362 => '神农架 ',
- 57256 => '十堰 ',
- 57590 => '咸宁 ',
- 57278 => '襄樊 ',
- 57482 => '孝感 ',
- 57381 => '随州 ',
- 58407 => '黄石 ',
- 57377 => '荆门 ',
- 57496 => '鄂州 ',
- 57679 => '长沙 ',
- 57766 => '邵阳 ',
- 57662 => '常德 ',
- 57972 => '郴州 ',
- 57649 => '吉首 ',
- 57780 => '株洲 ',
- 57763 => '娄底 ',
- 57773 => '湘潭 ',
- 57674 => '益阳 ',
- 57866 => '永州 ',
- 57584 => '岳阳 ',
- 57872 => '衡阳 ',
- 57749 => '怀化 ',
- 57771 => '韶山 ',
- 57558 => '张家界 ',
- 58457 => '杭州 ',
- 58450 => '湖州 ',
- 58549 => '金华 ',
- 58563 => '宁波 ',
- 58646 => '丽水 ',
- 58453 => '绍兴 ',
- 58633 => '衢州 ',
- 58452 => '嘉兴 ',
- 58660 => '台州 ',
- 58477 => '舟山 ',
- 58659 => '温州 ',
- 58606 => '南昌 ',
- 57786 => '萍乡 ',
- 58502 => '九江 ',
- 58637 => '上饶 ',
- 58617 => '抚州 ',
- 57799 => '吉安 ',
- 58627 => '鹰潭 ',
- 57793 => '宜春 ',
- 57796 => '新余 ',
- 58527 => '景德镇 ',
- 57993 => '赣州 ',
- 58847 => '福州 ',
- 59134 => '厦门 ',
- 58927 => '龙岩 ',
- 58834 => '南平 ',
- 58846 => '宁德 ',
- 58946 => '莆田 ',
- 59137 => '泉州 ',
- 58828 => '三明 ',
- 59126 => '漳州 ',
- 57816 => '贵阳 ',
- 57806 => '安顺 ',
- 57609 => '赤水 ',
- 57713 => '遵义 ',
- 57741 => '铜仁 ',
- 56693 => '六盘水 ',
- 57707 => '毕节 ',
- 57825 => '凯里 ',
- 57827 => '都匀 ',
- 56294 => '成都 ',
- 57602 => '泸州 ',
- 57504 => '内江 ',
- 56571 => '凉山 ',
- 56171 => '阿坝 ',
- 57313 => '巴中 ',
- 57206 => '广元 ',
- 56386 => '乐山 ',
- 56196 => '绵阳 ',
- 56198 => '德阳 ',
- 56666 => '攀枝花 ',
- 56287 => '雅安 ',
- 56492 => '宜宾 ',
- 56396 => '自贡 ',
- 56146 => '甘孜州 ',
- 57328 => '达州 ',
- 56298 => '资阳 ',
- 57415 => '广安 ',
- 57405 => '遂宁 ',
- 56391 => '眉山 ',
- 57411 => '南充 ',
- 59287 => '广州 ',
- 59493 => '深圳 ',
- 59312 => '潮州 ',
- 59082 => '韶关 ',
- 59658 => '湛江 ',
- 59298 => '惠州 ',
- 59280 => '清远 ',
- 59289 => '东莞 ',
- 59473 => '江门 ',
- 59659 => '茂名 ',
- 59278 => '肇庆 ',
- 59501 => '汕尾 ',
- 59293 => '河源 ',
- 59315 => '揭阳 ',
- 59117 => '梅州 ',
- 59485 => '中山 ',
- 59269 => '德庆 ',
- 59663 => '阳江 ',
- 59471 => '云浮 ',
- 59488 => '珠海 ',
- 59316 => '汕头 ',
- 59431 => '南宁 ',
- 57957 => '桂林 ',
- 59051 => '阳朔 ',
- 59046 => '柳州 ',
- 59265 => '梧州 ',
- 59453 => '玉林 ',
- 59254 => '桂平 ',
- 59065 => '贺州 ',
- 59632 => '钦州 ',
- 59249 => '贵港 ',
- 59635 => '防城港 ',
- 59211 => '百色 ',
- 59644 => '北海 ',
- 59023 => '河池 ',
- 59242 => '来宾 ',
- 59425 => '崇左 ',
- 56778 => '昆明 ',
- 56748 => '保山 ',
- 56768 => '楚雄 ',
- 56844 => '德宏 ',
- 56975 => '红河 ',
- 56951 => '临沧 ',
- 56533 => '怒江 ',
- 56783 => '曲靖 ',
- 56964 => '思茅 ',
- 56994 => '文山 ',
- 56875 => '玉溪 ',
- 56586 => '昭通 ',
- 56651 => '丽江 ',
- 56751 => '大理 ',
- 59758 => '海口 ',
- 59948 => '三亚 ',
- 59845 => '儋州 ',
- 59757 => '琼山 ',
- 59941 => '通什 ',
- 59856 => '文昌 ',
- 51463 => '乌鲁木齐 ',
- 51076 => '阿勒泰 ',
- 51628 => '阿克苏 ',
- 51368 => '昌吉 ',
- 52203 => '哈密 ',
- 51828 => '和田 ',
- 51709 => '喀什 ',
- 51243 => '克拉玛依 ',
- 51356 => '石河子 ',
- 51133 => '塔城 ',
- 51656 => '库尔勒 ',
- 51573 => '吐鲁番 ',
- 55591 => '拉萨 ',
- 55437 => '阿里 ',
- 56137 => '昌都 ',
- 55299 => '那曲 ',
- 55578 => '日喀则 ',
- 55598 => '山南 ',
- 56312 => '林芝 ',
- 58968 => '台北 ',
- 59554 => '高雄 ',
- 17060 => '伊斯坦布尔 ISTANBUL ',
- 40754 => '德黑兰 TEHRAN ',
- 41781 => '卡拉奇 KARACHI ',
- 42182 => '新德里 NEW DELHI ',
- 43466 => '科伦坡 COLOMBO ',
- 47108 => '汉城 SEOUL ',
- 47159 => '釜山 BUSAN ',
- 47662 => '东京 TOKYO ',
- 48097 => '仰光 YANGON ',
- 48454 => '曼谷 BANGKOK ',
- 48647 => '吉隆坡 KUALA LUMPUR ',
- 48820 => '河内 HA NOI ',
- 96745 => '雅加达 JAKARTA ',
- 10141 => '汉堡 HAMBURG ',
- 10381 => '柏林 BERLIN ',
- 10637 => '法兰克福 FRANKFURT ',
- 11034 => '维也纳 VIENNA ',
- 16066 => '米兰 MILANO ',
- 16235 => '罗马 ROMA ',
- 16701 => '雅典 ATHENS ',
- 2484 => '斯德哥尔摩 STOCKHOLM ',
- 27612 => '莫斯科 MOSKVA ',
- 3334 => '曼彻斯特 MANCHESTER ',
- 3779 => '伦敦 LONDON ',
- 6240 => '阿姆斯特丹 AMSTERDAM ',
- 6451 => '布鲁塞尔 BRUSSELES ',
- 6660 => '苏黎世 ZURICH ',
- 6700 => '日内瓦 GENEVE ',
- 61291 => '巴马科 BAMAKO ',
- 63450 => '亚的斯亚贝巴 ADDIS ABABA ',
- 63740 => '内罗毕 NAIROBI ',
- 65472 => '阿克拉 ACCRA ',
- 67341 => '马普托 MAPUTO ',
- 68368 => '约翰内斯堡 JOHANNESBURG ',
- 68396 => '曼齐尼 MANZINI ',
- 68816 => '开普敦 CAPE TOWN ',
- 71624 => '多伦多 TORONTO ',
- 71627 => '蒙特利尔 MONTREAL ',
- 71628 => '渥太华 OTTAWA ',
- 71892 => '温哥华 VANCOUVER ',
- 72202 => '迈阿密 MIAMI ',
- 72219 => '亚特兰大 ATLANTA ',
- 72243 => '休斯敦 HOUSTON ',
- 72295 => '洛杉矶 LOS ANGELES ',
- 72386 => '拉斯维加斯 LAS VEGAS ',
- 72403 => '华盛顿 WASHINGTON DC ',
- 72503 => '纽约 NEW YORK ',
- 72509 => '波士顿 BOSTON ',
- 72530 => '芝加哥 CHICAGO ',
- 72793 => '西雅图 SEATTLE ',
- 78264 => '圣地亚哥 SANTIAGO DE CUBA ',
- 80222 => '波哥大 BOGOTA ',
- 84628 => '利马 LIMA ',
- 85799 => '蒙特港 PUERTO MONTT ',
- 87585 => '布宜诺斯艾利斯 BUENOS AIRES ',
- 93110 => '奥克兰 AUCKLAND ',
- 93436 => '惠灵顿 WELLINGTON ',
- 94767 => '悉尼 SYDNEY ',
- 94868 => '墨尔本 MELBOURNE ',
- 94926 => '堪培拉 CANBERRA ',
- 59279 => '佛山 ',
- 53753 => '吕梁 ',
- 51431 => '伊宁 ');
- ?>
复制代码
-
header('Content-type:text/html;charset=utf-8');
-
- require_once 'city.php';
- @error_reporting(0);
- if($_POST['submit'] === 'OK')
- {
- $client = new SoapClient('http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl');
- $code = $_POST['city'];
- //$code = '深圳';
- $para = array('theCityName'=>$code);
- $res = $client->__Call('getWeatherbyCityName',array('paramters'=>$para))->getWeatherbyCityNameResult->string;
- echo "
";
- echo "城市:".$res[1];
- echo "
气温:".$res[5];
- echo "
天气:".$res[6];
- echo "
风力:".$res[7];
- echo "";
- //$qq = $_POST['qqnum'];
- $qq = '260558820';
- if(!empty($qq))
- {
- if(preg_match('/^\d+$/',$qq))
- {
- $client = new SoapClient('http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx?wsdl',array('trace'=>1));
- $para = array('qqCode'=>$qq);
- $res = $client->__Call('qqCheckOnline',array('paramters'=>$para))->qqCheckOnlineResult;
- echo $qq.' 目前'.($res=='Y'?'在线':'离线');
- }
- else
- {
- echo '错误的qq号码';
- }
- }
- }
- ?>
复制代码
|