Normally in a web page you have your code to display a Flash movie which points to the source SWF file (e.g. src=”example.swf” or value=”example.swf”). I can replace the SWF file with a PHP script which will output the same movie (e.g. src=”example.php”) so that the end result is the same. The PHP script can be as simple as:
Code:
<?php
$file = ‘example.swf’;

if (file_exists($file)) {
    header('Content-Type: application/x-shockwave-flash');
    header('Content-Disposition: inline;filename=example.swf’);
    header('Content-Length: ' . filesize($file));
    ob_clean();
    flush();
    readfile($file);
    exit;
}
?>
This works. However my issue is that I need to pass variables into example.swf so that the user doesn’t see them. In the above example I tried to use $file = ‘example.swf?foo=bar’; but that failed, as did trying to append a query string to the SWF file in the readfile line. Placing the query string in the header line isn’t an option since users can see that. Does anyone know of a way to pass variables to a SWF in PHP so that PHP can output the movie to the user?