I'm calling my php script that generates the google chart (POST method http://code.google.com/apis/chart/docs/post_requests.html) and has this code to output the image (the page is set to png output):
$context = stream_context_create(
array('http' => array(
'method' => 'POST',
'content' => http_build_query($chart))));
fpassthru(fopen($url, 'r', false, $context));
I call the script as an image (...img src="gchart.php?.....)
All works fine, but i'd like to cache the results of the above, how can i capture the output of post request and store as png file?
Can't you just capture the response from fopen and use file_put_contents to save it as a PNG, then render your <img> tag to point to that file?
Caching POST results doesn't make sense since using POST implies that the info returned is expected to change between calls. That is what POST is for - if you know the data will always stay the same then you should be using GET so that the browser will know it is allowed to cache the results.