我正在嘗試使用uTorrent webUI API。我認爲這是一個相當不錯的問題,但在網絡上很少有關於此API的文檔,對不起。用PHP解析內容
我的服務器使用file_get_contents($ url),我得到我想要的數據。但採用的格式我不明白。
例如:
{
"build": BUILD NUMBER (integer),
"label": [
[
LABEL (string),
TORRENTS IN LABEL (integer)
],
...
],
"torrents": [
[
HASH (string),
STATUS* (integer),
NAME (string),
SIZE (integer in bytes),
PERCENT PROGRESS (integer in per mils),
DOWNLOADED (integer in bytes),
UPLOADED (integer in bytes),
RATIO (integer in per mils),
UPLOAD SPEED (integer in bytes per second),
DOWNLOAD SPEED (integer in bytes per second),
ETA (integer in seconds),
LABEL (string),
PEERS CONNECTED (integer),
PEERS IN SWARM (integer),
SEEDS CONNECTED (integer),
SEEDS IN SWARM (integer),
AVAILABILITY (integer in 1/65536ths),
TORRENT QUEUE ORDER (integer),
REMAINING (integer in bytes)
],
...
],
"torrentc": CACHE ID** (string integer)
}
洪流就像[A,B,C,d]。並且每個種子都以逗號分隔
所以我最終得到一個這樣的文件:[a,b,c,d],[a,b,c,d],[a,b,c,d] 。我不知道這個結構是否有名字。
現在,我該如何將它轉換成更像XML的可讀性? 謝謝
= D謝謝!我知道這很容易 – DrPotato 2010-10-28 21:16:59