Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6682393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:42:03+00:00 2026-05-26T04:42:03+00:00

I have many XML-s and I downloaded using file or file_get_content, but the server

  • 0

I have many XML-s and I downloaded using file or file_get_content, but the server administrator told me that through GZIP is more efficient the downloading. My question is how can I include GZIP, because I never did this before, so this solution is really new for me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:42:04+00:00Added an answer on May 26, 2026 at 4:42 am

    I don’t understand your question.

    You say that you downloaded these files – you can’t unilaterally enable compression client-side.

    OTOH you can control it server-side – and since you’ve flagged the question as PHP, and it doesn’t make any sense for your administrator to recommend compression where you don’t have control over the server then I assume this is what you are talking about.

    In which case you’d simply do something like:

    <?php
    ob_start("ob_gzhandler");
    ...your code for generating the XML goes here
    

    …or maybe this is nothing to do with PHP, and the XML files are static – in which case you’d need to configure your webserver to compress on the fly.

    Unless you mean that compression is available on the server and you are fetching data over HTTP using PHP as the client – in which case the server will only compress the data if the client provides an “Accept-Encoding” request header including “gzip”. In which case, instead of file_get_contents() you might use:

    function gzip_get_contents($url)
    {
         $ch=curl_init($url);
         curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         $content=curl_exec($ch);
         curl_close($ch);
         return $content;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have many xml file's, I do not want to get the value, but
I am using SSIS in Visual Studio 2008. I have many XML files that
I have a xml that has so many elements and most of that contain
I have an XML file which has many section like the one below: <Operations>
I have many many XML files that often contain nodes mutiple times (each time
Many of us have been indoctrinated in using XML for storing data. It's benefits
I have seen in many XML file has the data inside this <![CDATA[ ]]>
I have XML documents that have many characters that are UTF-8 such as É
Let's say I have to read from a directory that has many large XML
I have an XML file that I want to parse into a database in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.