SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    gzipping textarea content with php

    Im about 80% through an application that im constructing that downloads/decompress/decodes xml.gz files the fly files from my server and shows the output in a textarea for editing all this part works perfect,

    but heres my stumbling block:

    After editing i then need to encode/gzcompress the textarea contents by php and have the file offered up for downloading (without the page changing) so my problems are

    1) how to re-encode/gzcompress the edited text
    2) how to offer up for downloading

    heres the code i have upto yet which displays the xml

    PHP Code:
    <textarea rows="30" name="rawxml" cols="111" class="outputs" >
    <?php
    $fh 
    fopen("datafeed.xml""r");

    $file file_get_contents("datafeed.xml");
    echo 
    $file;
    ?>
    </textarea>
    <?php
    $content 
    file_get_contents("$file");
            
    $coded base64_encode(gzcompress("$file"));
    ?>
    <p align="center">
    <input name="submit" type="submit" value="encode xml" />
    </p>
    </form>
    Im pretty un-experienced in .php (amazed myself i got this far actually) but could do with some pointers for this..thanks

  2. #2
    SitePoint Enthusiast
    Join Date
    Feb 2010
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Yes you may or may not write more to make this script workable. You can certainly add php header for downloading the file as gzip format.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •