php读取maxmind的二进制ISP文件

php读取maxmind的二进制ISP文件,php,geolocation,Php,Geolocation,我试图通过PHP函数读取ISP二进制文件(以FIPS 10-4格式编码)。但它以无法读取的格式返回数据 $filename = 'D:\xampp\htdocs\openx\var\jeet\GeoIPISP.dat'; $handle = fopen($filename, "rb"); $fsize = filesize($filename); $contents = fread($handle, $fsize); // iterate throug

我试图通过PHP函数读取ISP二进制文件(以FIPS 10-4格式编码)。但它以无法读取的格式返回数据

    $filename = 'D:\xampp\htdocs\openx\var\jeet\GeoIPISP.dat';
    $handle = fopen($filename, "rb");
    $fsize = filesize($filename);
    $contents = fread($handle, $fsize);



   // iterate through each byte in the contents
   for($i = 0; $i < $fsize; $i++)
 { 
 // get the current ASCII character representation of the current byte
  $asciiCharacter = $contents[$i];
 // get the base 10 value of the current characer
 $base10value = ord($asciiCharacter);
 // now convert that byte from base 10 to base 2 (i.e 01001010...)
 $base2representation = base_convert($base10value, 10, 2);
 // print the 0s and 1s

 $base10value = base_convert($base2representation, 2, 10);  // => 132
 $ASCIICharacter = chr($base10value);               // => 'Z'
  echo  $ASCIICharacter; 
 }
$filename='D:\xampp\htdocs\openx\var\jeet\GeoIPISP.dat';
$handle=fopen($filename,“rb”);
$fsize=文件大小($filename);
$contents=fread($handle,$fsize);
//遍历内容中的每个字节
对于($i=0;$i<$fsize;$i++)
{ 
//获取当前字节的当前ASCII字符表示形式
$asciiCharacter=$contents[$i];
//获取当前字符的基数10值
$base10value=ord($ascicharacter);
//现在将该字节从基10转换为基2(即01001010…)
$base2representation=base\u convert($base10value,10,2);
//打印0和1
$base10value=base_convert($base2representation,2,10);//=>132
$ascicharacter=chr($base10value);//=>Z'
echo$ascicharacter;
}

有人知道我如何将二进制文件的所有数据转换成php字符串/数组吗?

file\u get\u contents
此外,该线程可能会解释引用线程中的@cups格式,它们正在传递单个IP并相应地获取值,这与我的情况不同。我需要二进制文件中的所有数据。