2013-01-21 83 views
0

可能重複:
Best XML Parser for PHP從XML解析器讀取數據

我想顯示陣列我從這個URL獲得一個表在我的網站。但是我不知道從哪裏開始。這個鏈接是

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

感謝您的幫助。

+2

你想知道從哪裏開始? ['DOMDocument'](http://php.net/manual/en/class.domdocument.php)。 –

回答

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; 
}