A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: PHP No-Cache

  1. #1
    Senior Member
    Join Date
    Apr 2004
    Posts
    111

    PHP No-Cache

    I seem to be the only guy that can't stop my PHP files caching ... so I thought someone might help me out ...

    My Flash Movie submits a sendAndLoad to my php file ... the file collects data from a mysql database ... and the results are sent back to flash using the echo command in php. This all works fine right now.

    When i put the PHP headers in to try and stop the php file caching the results are no longer being received.

    The headers i am using are below:

    header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
    header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    // always modified
    header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
    header ("Pragma: no-cache"); // HTTP/1.0

    Thanks in advance.
    Trying deperately to understand
    actionscript

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    have you tried to access the php file in browser to see whether you actually get a response?

    Musicman

  3. #3
    Senior Member
    Join Date
    Apr 2004
    Posts
    111
    Hi Musicman,

    I have copied the file from the cahce and edited it ... it is not the PHP source but the returned mysql results being echoed back to flash.

    Thanks
    Trying deperately to understand
    actionscript

  4. #4
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    you could add a unique number to force the server to send fresh data -

    verDate = new Date();
    verTime = verDate.getTime();
    path = "test.php?vers="+verTime;

    use 'path' in your sendAndLoad

  5. #5
    Senior Member
    Join Date
    Apr 2004
    Posts
    111
    that will make sure that the latest results will be in the cached file ... my problem is that I don't want the file to be cached at all.
    Trying deperately to understand
    actionscript

  6. #6
    Senior Member
    Join Date
    Apr 2004
    Posts
    111
    I have done more testing ... turns out that the header works fine on my php file and does not cache if I call it independently ... however if I call it from flash then it gets cached.
    Trying deperately to understand
    actionscript

  7. #7
    Senior Member
    Join Date
    Apr 2004
    Posts
    111
    It seems that the only command which stops the results apperaing in the php filename in the cache is: header("Pragma: no-cache") ... this is also the one that stops the results being fed back into flash after my sendandload command.
    Trying deperately to understand
    actionscript

  8. #8
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    I am very sure this has worked for me ....

    Musicman

  9. #9
    Senior Member
    Join Date
    Jun 2006
    Posts
    100
    Just add "?27662382" to the end of the file you want to be called. Eg:

    "www.flashkit.com/mysite.php?736262" That prevents the site from being cached.

  10. #10
    Senior Member
    Join Date
    Apr 2004
    Posts
    111
    Thanks Silvervenom ... I think I have found the problem, it seems to center around how that works differently on secure connections ... I have been able to stop the .php files caching now and I'm just trying to sort out the jpeg and swf files now as some do not cache but others do.

    Thanks for the reply.
    Trying deperately to understand
    actionscript

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center