Php 应为XML解析器错误开始标记
警告:simplexml加载字符串()[函数.simplexml加载字符串]:实体:第1行:解析器错误:应为开始标记,“您正在加载URL作为XML源。你应该:Php 应为XML解析器错误开始标记,php,html,xml,steam,Php,Html,Xml,Steam,警告:simplexml加载字符串()[函数.simplexml加载字符串]:实体:第1行:解析器错误:应为开始标记,“您正在加载URL作为XML源。你应该: function retrieveProfile() { $url = "http://steamcommunity.com/profiles/{$this->steamID64}/?xml=1"; $profileData = simplexml_load_string($url); if(!empty
function retrieveProfile()
{
$url = "http://steamcommunity.com/profiles/{$this->steamID64}/?xml=1";
$profileData = simplexml_load_string($url);
if(!empty($profileData->error)) { return NULL; }
$this->friendlyName = (string) $profileData->steamID;
}
Url正在从steamcommunity.com/profiles/76561197991676121/?xml=1更改为。
显然,第一个链接返回null,因此出现了错误。问题解决了 现在我有更多的错误!第20行的/home/a3184184/public_html/openid/includes/streamapi.class.php中的文档为空,其他文档为空@virusbogdan第20行是什么?我试着解析
http://steamcommunity.com/profiles/76561197991676121/?xml=1
使用您的代码,它可以正常工作。我知道它可以正常工作,但对我来说不是。第20行:$profileData=$profileData=simplexml\u load\u文件($url);您可以在打印之前打印$url
<代码>echo$url并检查该值是否符合预期。你能做一个$data=file\u获取内容($url)
然后回显$data
?你得到文件的内容了吗?$url是正确的,但是$data看起来是空的。。。有趣。为什么是空的?我确实回显了“[”$data.”;返回[]不太明显file\u get\u contents()
应该遵循重定向,我测试它时就是这样做的。这可能是一个PHP问题:。但是任何对你有用的东西,对我的主人来说都是显而易见的*。现在我需要找出如何获取重定向链接。。。任何IDEA?警告:simplexml加载文件()[函数.simplexml加载文件]:I/O警告:加载外部实体失败“”-返回空链接。如果无效,请使用get\u headers()
并访问位置:
头。
$profileData = simplexml_load_file($url);