ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-general
php-general
[PHP] Decompressing a string with zlib problems
by Graham Anderson other posts by this author
Oct 27 2005 4:02PM messages near this date
Re: [PHP] PHP5 class constants | Re: [PHP] Decompressing a string with zlib problems
I am having problems decompressing a zlib'd string located in a file.

In the file headers, the compression says that it is  zlib.
But, when I  'gzinflate' the string, I get the error: gzinflate():  
data error in <b
Is the below NOT a zlib or some strange variant ?

anyone know ?
g

<?php
$hex="C0636D7664000003DE789C95533B4E0331109D2408C44FA200125084568212D153 
2040A2A02012120D05142636BB26B677659B20B8000D05D7E00674882B70000EC1018019 
67974D365060E569C76F3CEF4D66BD008D779DA67D0050BA9F707CC2CBFDE43301A07E1A 
5003FA956B6433BEDFFB89A87E6CD5011AF3DEB21EC667BE173C1BA567A156D67E7DFEC3 
772207C086E0DEE1B32D94F36545AE1B6AEB4673C9308834FFE3BF031C227613AE2CE575 
A2ACCBAC6759A6824AADF6BA769259E945B46FA4665EA626EA08948D0E99E14A60597D4A 
4B734936B10E36AD188941CF5F61E5ED6D17361C6D98928E6C1606366FAD7DDCA08B92CC 
4507CC0F19C0061F18B4B9159743D39923913C7E74FE827ADE74DEF1A133EDBF270A2DE7 
C30C8B5C31BF366A7447F91F2C62EE6E909A7928B96E5A79071FDD948B8ADFBB13CCE435 
D339B78A10BFF406B04C2F642443510BD1AB9CA77809910CF3057955155FEAE1D5A99264 
A6C6DAA07A5915A50EE2CA51BA93CD6BEEE9B6CD1AA605B73A4F9DE7F4FA93BBB1D004E8 
302EA21BE993E848F6C58967B1888E2DCD6F2553D7B14EFB5290C40E6A6CE9F0F1CE75FD 
6D665243839ACE14BB0DCADFAFDD8C760000003C";

// Convert the hex to a string
$string = pack("H*", $hex);

//echo it
echo "the compressed string is:". "\r\n";
echo $string;


//decompress the string
$uncompressed =gzinflate($string);
echo "the uncompressed string is: ".$uncompressed;

?> 

The Output SHOULD look something like this:
8trak88øá    8Animation Media Handlergmhdle Alias Data Handleralis

The compressed output is:

the compressed string is:
??t?+p??g?M6P`?i?o<?Mf??w??}P??p|????3?~P??kd3?????~l??Þ²?g?<g?V?~}?? 
w"?????-??eE??Fs?0?4??"v?,?u??ˬgY??J???v?Y?E?o?f^?&????J`Y}JKsI6?6??A? 
_a??m6m???l6o?}Ü ???E?????CÓ?#?<~t??z?t??3?'
-??
    ?\1?6jtG?,b?n??y(?nZy 9?????L/d$CQ
                                             Ñ«??x        ?
߯Ý?v<                                                    ?yU_??Õ©?d?? 
Ú zY???Q???k?????:O?????????0.??H?Å?g???-?o%S×±N?R??jl????u?mfRC???? 
Ï?nZyâ?ºÃ®Ã£Ã¤ï¬?ªÃ?â?°5â?9â??äøÃ?â??L/d$CQâ??´úÃ?x    ë 
Ã?yU_Í·â??©íd¶â??â?â? zYâ?¢ 
â?? Qâ?«Ã¬Ã?kÃ?Ã?â??Ã?¶â??:OùÁÃ?Ë?쪱â??Ã?0.¢ 
Ã?ìÃ?HË?â??âg±àé-Ã?o%Sâ??±NË?RêÆ?jlÃ?Ã?Å?u˝mfRCÃ?öÅ?ª
  ���åv
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Thread:
Graham Anderson
Robin Vickery
Graham Anderson
Jochem Maas

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved