- <?php
- $path = 'http://xxx.xxx.xxx/example.xml';
- $str = file_get_contents($path);
- $str = <<<str
- ...
- <yw:cdtn text="Fair" code="34" temp="7" date="Thu, 10 Apr 2008 9:50 am BST" />
- ...
- <yw:f day="Thu" date="10 Apr 2008" low="1" high="11" text="Light Rain" code="11" />
- <yw:f day="Fri" date="11 Apr 2008" low="1" high="10" text="Light Rain" code="11" />
- ...
- str; //开源代码Vevb.com
- preg_match('/<yw:cdtn.*text="(.*)"/iU', $str, $arr);
- echo $arr[1];
- preg_match_all('/<yw:f.*text="(.*)"/iU', $str, $arr);
- print_r($arr[1]);
- ?>
新闻热点
疑难解答