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

警告:simplexml_load_string()[function.simplexml-load-string]:エンティティ:1行目:パーサーエラー:開始タグが必要です、'<'が見つかりません

警告:simplexml_load_string()[function.simplexml-load-string]:http ://steamcommunity.com/profiles/76561197991676121/?xml=1

警告:simplexml_load_string()[function.simplexml-load-string]:^

これはXMLファイルです。

http://steamcommunity.com/profiles/76561197991676121/?xml=1

なぜそれが機能しないのか、そしてはい、<?xml version="1.0" encoding="UTF-8" standalone="yes"?>ヘッダーがあります!試し$profileData = new SimpleXMLElement(file_get_contents($url))ましたが、同じ結果になりました。

なぜこうなった ?どうすれば解決できますか?私は3時間検索していますが、役に立たない回答しか表示されません。
エラー: http: //img824.imageshack.us/img824/9464/errorszz.png

EDIT1:simplexml_load_stringは私の間違いの1つでしたが、simplexml_load_fileでさらに多くのエラーが発生します-ドキュメントが空であることを教えてくれます...(真実ではありません!)

4

2 に答える 2

6

URL を XML ソースとしてロードしています。あなたが持っている必要があります:

$profileData = simplexml_load_file($url);
于 2012-08-21T17:19:37.877 に答える
1

URL が steamcommunity.com/profiles/76561197991676121/?xml=1 からhttp://steamcommunity.com/id/virusbogdan/?xml=1に変更されました。明らかに、最初のリンクは null を返すため、エラーが発生しました。問題が解決しました !

于 2012-08-21T18:01:22.257 に答える