SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Dec 2001
    Location
    Market Harborough, UK
    Posts
    206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Headers for dynamic content

    Hi,

    Part of my website creates pdf files dynamically (using PHP) and displays them in a popup. Unfortunately, I have an issue which is due (I think) to local caching.

    What happens is that the first time a page is called up, it works fine. If it is re-called fairly quickly, then you get an instant "page not available" error. The browser doesn't even appear to make the request to to server.

    I suspect some sort of local caching issue and was wondering if anyone could tell me what header I need to send with the page to inform the browser that the page is not to be cached.

    TIA

    Cheers,

    Paul
    Last edited by pauls; Oct 23, 2003 at 03:09.
    Paul Simpson, BSc, MCNI, MCNE

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    In PHP:
    PHP Code:
    header("cache-control: no-store"); 

  3. #3
    SitePoint Addict
    Join Date
    Dec 2001
    Location
    Market Harborough, UK
    Posts
    206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for that!

    Are there any rules as to order of headers?

    I now have:
    PHP Code:
    pdf_close($p);
    $buf=pdf_get_buffer($p);
    $len=strlen($buf);
    header("Content-type: application/pdf");
    header("Content-Length: $len");
    header("Content-Disposition: inline; filename=grouplist.pdf");
    header("cache-control: no-store" ); 
    print 
    $buf;
    pdf_delete($p); 
    And when I try to open the site, I get the "do you want to open / save" dialog come up. If I click open "Open" it fails

    If I take the last header line out, it starts "working" again, but displays the original problem.

    I can only assume I'm missing something or that the header order matters....
    Paul Simpson, BSc, MCNI, MCNE


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
  •