我试图读取此xml:XML RSS文件
但没有成功。
Warning: simplexml_load_file(): http://noticias.perfil.com/feed/:232: parser error : CData section not finished <p>La sola lectura de los datos estadísticos desp in D:xamppFerreWooscrap-rvnot.php on line 43
Warning: simplexml_load_file(): Isis, con lo que habría logrado un nuevo respaldo a sus proyectos terroristas. in D:xamppFerreWooscrap-rvnot.php on line 43
Warning: simplexml_load_file(): ^ in D:xamppFerreWooscrap-rvnot.php on line 43
im使用此代码:
$feed = simplexml_load_file($urls, null, LIBXML_NOCDATA);
我也尝试卷曲,但同样的erros仍在开始。
我知道de xml文件可能不正确...但是必须有一种阅读的方法,对
您在该XML上有一些无效的字符。在下面尝试此代码
$url = 'http://noticias.perfil.com/feed/';
$html = file_get_contents($url);
$invalid_characters = '/[^x9xax20-xD7FFxE000-xFFFD]/';
$html = preg_replace($invalid_characters, '', $html);
$xml = simplexml_load_string($html);
//test purpose part
$encode = json_encode($xml);
$decode = json_decode($encode, true);
print_r($decode);
希望它有帮助