从xml解析器获取数据

时间:2013-01-21 02:32:19

标签: php xml parsing

1 个答案:

答案 0 :(得分:0)

为什么不试试this简单的HTML解析器?

$data = Array();
$html = file_get_html('http://www.islamicfinder.org/prayer_service.php?country=usa&city=germantown&state=MD&zipcode=20876&latitude=39.2074&longitude=-77.2311&timezone=-5&HanfiShafi=1&pmethod=5&fajrTwilight1=10&fajrTwilight2=10&ishaTwilight=10&ishaInterval=30&dhuhrInterval=1&maghribInterval=1&dayLight=1&simpleFormat=xml');

foreach($html->find('prayer') as $prayer)
{
    $data['fayr']    = $prayer->find('fayr', 0)->plaintext;
    $data['sunrise'] = $prayer->find('sunrise', 0)->plaintext;
    $data['dhur']    = $prayer->find('dhur', 0)->plaintext;
}