0

可能重复:
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&dhuhrday&isha&maghribInterval=1&isha&maghribInterval=1& 1&simpleFormat=xml

谢谢你的帮助。

4

1 回答 1

0

为什么不试试这个简单的 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;
}
于 2013-01-21T03:08:01.893 回答