Welcome, Guest. Please Login
Back to main page
  News:
Welcome to the ShadowFlare's Realm Forums.  New registrations are by request only.  To be considered for a new forum account, send an e-mail with the user name and display name you want and the reason you want to register.
  Home SFRealm HelpSearchLogin  
 
Pages: 1
Send Topic Print
Help me please! (Read 942 times)
BuLdOzEr
Peon
*
Offline

I love YaBB 1G -
SP1!

Posts: 3

Help me please!
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! :(
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print