从PHP上解压缩gzip文件 [英] Uncompress a gzip file from CURL, on php

查看:282
本文介绍了从PHP上解压缩gzip文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道如何解压缩curl?gzip文件的内容?

Does anyone know how to uncompress the contents of a gzip file that i got with curl?

例如: http://torcache.com/torrent/63ABC1435AA5CD48DCD866C6F7D5E80766034391.torrent

回应

HTTP/1.1 200 OK
Server: nginx
Date: Wed, 09 Jun 2010 01:11:26 GMT
Content-Type: application/x-bittorrent
Content-Length: 52712
Last-Modified: Tue, 08 Jun 2010 15:09:58 GMT
Connection: keep-alive
Expires: Fri, 09 Jul 2010 01:11:26 GMT
Cache-Control: max-age=2592000
Content-Encoding: gzip
Accept-Ranges: bytes

然后压缩gzip,

我试过gzdecode但是不工作,gzeflate也不是他们根本没有得到任何响应,并且文件的内容不超过2k

i tried gzdecode but doesn't work , gzeflate as well doesn't they simply don't get any response, and the contents of the files are no more than 2k

推荐答案

使用 gzdecode

<?php
    $c = file_get_contents("http://torcache.com/" .
        "torrent/63ABC1435AA5CD48DCD866C6F7D5E80766034391.torrent");
    echo gzdecode($c);

提供


d8:announce42:http://tracker.openbittorrent.com/announce13:announce-listll42
...

这篇关于从PHP上解压缩gzip文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆