Page Index Toggle Pages: 1
Topic Tools
Normal Topic Help me please! (Read 1053 times)
BuLdOzEr
Peon
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Feb 12th, 2005
Help me please!
Feb 12th, 2005 at 11:57pm
Post Tools
Hi, i'm newbie in PHP and *.w3g format too.  :(
I trying to write php script for *.w3g parsering.
Here is code:

[pre]
<?php // php 4.3.10 with builtin zlib
$hFile = fopen('example.w3g', 'r'); //this replay is CORRECT, // i check it with w3gmaster and with w3chart
// also i tryed some others replays

// 68 is position of first compressed data block
// in TFT 1.17 replays

fseek($hFile, 68); 
$FileContent = fread($hFile, 4);
$BlockHeader = unpack('vCompSize/@2/vUncompSize', $FileContent);
echo('<br>Compressed block size: ' . $BlockHeader['CompSize']); // for this replay 3209
echo('<br>Size of uncompressed block: ' . $BlockHeader['UncompSize']); // 8192

// go to the start of compressed data
// (Current file pointer position + 4)

fseek($hFile, ftell($hFile) + 4); // or 76 (file pointer position)
$FileContent = fread($hFile, $BlockHeader['CompSize']); // line 18

// Here (in function gzinflate()) i ALWAYS get error: "PHP Warning:  gzinflate(): data error in C:\phpproj\index.php on line 22"

$UncompData = gzinflate($FileContent); // line 22
fclose($hFile);
?>
[/pre]

in line 22 i ALWAYS get error: "PHP Warning:  gzinflate(): data error in C:\phpproj\index.php on line 22".
How i can fix this error? Maybe need some convertions for $FileContent in line 18? Which? VERY need help!

P.S.: Sorry for my english! :(
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Topic Tools