How do I use file_get_contents to get a gzip'ed page on a remote web server in php?

前端 未结 2 1127
鱼传尺愫
鱼传尺愫 2020-12-12 03:08

I\'m trying to receive a gzip\'ed version of a page through file_get_contents in php 5.2.9

I was able to do it using fopen with the following code:

          


        
相关标签:
2条回答
  • 2020-12-12 03:22

    Have you tried this?

    $content = file_get_contents('http://example.com',false,$context);
    
    0 讨论(0)
  • 2020-12-12 03:38

    Try using 'compress.zlib://http://example.com'

    Answer taken from here: How can I read GZIP-ed response from Stackoverflow API in PHP?

    0 讨论(0)
提交回复
热议问题