ShadowFlare's Realm
http://sfsrealm.hopto.org/cgi-bin/yabb2/YaBB.pl
ShadowFlare's Realm Forums >> Program Development >> Help me please!
http://sfsrealm.hopto.org/cgi-bin/yabb2/YaBB.pl?num=1108249071

Message started by BuLdOzEr on Feb 12th, 2005, 11:57pm

Title: Help me please!
Post by BuLdOzEr on Feb 12th, 2005, 11:57pm

Hi, i'm newbie in PHP and *.w3g format too.  :(
I trying to write php script for *.w3g parsering.
Here is code:


<?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);
?>


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! :(

ShadowFlare's Realm » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.