Ok, so there is this PHP implementation of Last.FM API some guy wrote and I'm using it for a small project of mine. His implementation doesn't request gzipped data from Last.FM servers so I decided to modify his implementation to work with gzip to reduce bandwidth. I have no problem in requesting gzipped data, that works just fine and all the data comes compressed (checked). The problem is decoding it. I'm pretty new with PHP and I was trying to decode it for the last two days but nothing I tried worked. :D
Here is the function that asks for and receives the data. If anyone could please help me make this function decode the data I'd be really grateful.
function send ($msg) {
// Send message over connection
fwrite($this->handle, $msg);
$response = array();
$line_num = 0;
while ( !feof($this->handle) ) {
$response[$line_num] = fgets($this->handle, 4096);
$line_num++;
}
// Return response as array
return $response;
}
where $this->handle is
$this->handle = fsockopen($this->host, $this->port, $this->error_number, $this->error_string);
Thank you =)