php ·µ»ØxmlÐÅÏ¢´íÎó - PHP / »ù´¡±à³Ì
Õâ¸öµØÖ·£ºhttp://maps.google.com/ig/api?weather=shanghai&hl=zh-cn
ÊÇgoogle·µ»ØµÄÒ»¸öÌìÆøÔ¤±¨xml
Ïëµ÷Óõ½±¾µØÀ´£º
<?php
readfile('http://maps.google.com/ig/api?weather=shanghai&hl=zh-cn');
?>
Ìáʾ´íÎó£º
ÎÞ·¨ÏÔʾ XML Ò³¡£
ʹÓà XSL Ñùʽ±íÎÞ·¨²é¿´ XML ÊäÈë¡£Çë¸üÕý´íÎóÈ»ºóµ¥»÷ ˢа´Å¥£¬»òÒÔºóÖØÊÔ¡£
--------------------------------------------------------------------------------
Îı¾ÄÚÈÝÖз¢ÏÖÎÞЧ×Ö·û¡£´¦Àí×ÊÔ´ 'http://localhost/Flash_Weather/weather_google.php' ʱ³ö´í¡£µÚ 1 ÐУ¬Î»ÖÃ: 438
<?xml version="1.0"?><xml_api_reply version="1"><weather module_id="0" tab_id="0" mobile_row="0" mobile_zippe...
ÊÇÔõô»ØÊÂÄØ£¿Ð»Ð»ÁË..
readfile¶ÁÈëÒ»¸öÎļþ²¢Ð´Èëµ½Êä³ö»º³å¡£
·µ»Ø´ÓÎļþÖжÁÈëµÄ×Ö½ÚÊý¡£Èç¹û³ö´í·µ»Ø FALSE ²¢ÇÒ³ý·ÇÊÇÒÔ @readfile() ÐÎʽµ÷Ó㬷ñÔò»áÏÔʾ´íÎóÐÅÏ¢¡£
PHP code:
<?php
$data = file_get_contents('http://maps.google.com/ig/api?weather=shanghai&hl=zh-cn');
$parser = xml_parser_create();
xml_parse_into_struct($parser, $data, $values, $index);
xml_parser_free($parser);
var_dump($values);
?>
{{
Ïà¹ØÎÊ´ð£º
txt ºÍXML ¸ñʽÏàÓ¦
²»½èÖúDataSet
µ¼Èë¶ÁÈ¡TXTÎļþ
È»ºóÖ±½ÓдÈëXML(ͬһÎļþ,²»Í¬Êý¾Ý,µÝÔöÔÊý¾ÝûÓб»¸²¸ÇÇé¿öÏÂÔö¼ÓÊý¾Ý.)
½Ì¸öÒªµã»ò×îºÃÊÇÓиö´úÂëÌáʾµÄ
¹ý·ºÃºº °ï¸öæÈö^^
²»»á£¬°ïÂ¥Ö÷ ......
Ôڲɼ¯Ò»¸öÒ³ÃæµÄʱºòͨ³£¶¼ÊÇʹÓÃfile_get_contents($url)
²»¹ý·µ»ØµÄ½á¹ûÓÐʱºò»á²»È«
Èç¹ûÔÚhtmlÖÐʹÓà document.ready,ÔÚÒ³Ãæ×¼±¸ºÃºó£¬Ê¹ÓÃajax¶ÁÈ¡±ðÒ»²¿·ÖµÄÊý¾Ý
ÔÙͨ¹ýÐÞ¸Ähtml±êÇ©µÄÄÚÈÝ£¬¾Í²¿·ÖµÄÊý¾Ý¾ ......
´ÓÊý¾Ý¿âÖвéѯһÕűíµÄÊý¾Ý
select ²¿ÃÅ,ÐÕÃû from tb
ÈçºÎ²ÅÄÜÉú³ÉÏÂÃæµÄxml¸ñʽÎļþ
<folder state="unchecked" label="È«²¿">
¡¡¡¡<folder state="unchecked" isBra ......
XMLÎļþÄÚÈÝ£º
- <ResList>
<page>0</page>
- <resItem>
<resName>WWW</resName>
</resItem>
- <resItem>
&nb ......
mssql_select_db("f1",mssql_connect("localhost","sa","sa"));
mssql_select_db("f2",mssql_connect("192.168.0.1","sa","sa") ......