BEncoded PHP ライブラリを使用して、Bittorrent トラッカーからのベンコードされた応答をデコードしています。
トラッカーの応答は次のとおりです。
d5:filesd20:¼€™rÄ2ÞÊþVA .]á^¦d8:completei285e10:downloadedi22911e10:incompletei9eeee
以下のコードを使用してデコードした後:
require 'bencoded.php';
$be = new BEncoded;
//Response saved in scrape.txt
$data =file_get_contents('scrape.txt');
print_r($be->Decode($data));
出力は次のとおりです。
Array ( [files] => Array ( [¼€™rÄ2ÞÊþVA .]á^¦] => Array ( [complete] => 285 [downloaded] => 22911 [incomplete] => 9 [isDct] => 1 ) [isDct] => 1 ) [isDct] => 1 )
私の問題 上記の出力における私の問題は、出力内のこれらの不思議な文字をデコードする方法です。