$xml=simplexml_load_string(gzdecoder(file_get_contents('test.xml'))); print_r( $xml); function gzdecoder($d){ $f=ord(substr($d,3,1)); $h=10;$e=0; if($f&4){ $e=unpack('v',substr($d,10,2)); $e=$e[1];$h+=2+$e; } if($f&8){ $h=strpos($d,chr(0),$h)+1; } if($f&16){ $h=strpos($d,chr(0),$h)+1; } if($f&2){ $h+=2; } $u = gzinflate(substr($d,$h)); if($u===FALSE){ $u=$d; } return $u; }
source share