0

我正在编写一个 livecore 和统计网站,我想将我的网站“使用 php”链接到一个 xml 页面,以帮助我尽快获得分数和数据的更新。我尝试了以下 php 代码:

$xml = simplexml_load_file("http://www.iddaa.com.tr/XML/IDDAAMACPROGRAMI/index.htm?iddaadrawid=05.12.2012&iddaadrawide=06.12.2012&foraccess=KSsec654");

print_r($xml);

它给了我以下错误:

Warning: simplexml_load_file() [function.simplexml-load-file]: http://www.iddaa.com.tr/XML/IDDAAMACPROGRAMI/index.htm?iddaadrawid=05.12.2012&iddaadrawide=06.12.2012&foraccess=KSsec654:22: parser error : Opening and ending tag mismatch: link line 10 and head in C:\wamp\www\test\11.php on line 2

注意:我尝试了另一个链接“http://www.goalserve.com/samples/soccer_livescore.xml”我可以从该链接打印信息。

任何人都可以帮助我将xml文件正确链接到我的网站吗?

4

1 回答 1

0

你可以试试

$xml  = file_get_contents("http://www.iddaa.com.tr/XML/IDDAAMACPROGRAMI/index.htm?iddaadrawid=05.12.2012&iddaadrawide=06.12.2012&foraccess=KSsec654");
$config = array(
        'indent' => true,
        'clean' => true,
        'input-xml'  => true,
        'output-xml' => true,
        'wrap'       => false
);

$tidy = new Tidy();
$xml = $tidy->repairString($xml, $config);

$xml = new SimpleXMLElement($xml);
print_r($xml);
于 2012-12-06T12:45:34.513 回答