I’m using XAMPP on Windows.
I’ve congigured Apache to redirect all requests to a controller.php file. The controller logs all requests to the database before any other processing takes place and it does a few other things too including checking permission to access the files involved.
Most requests map to a file which I then serve with appropriate headers and a readfile. For example:
header ( 'Content-Type: text/css' );
header ( 'Content-Length: ' . filesize ( $file ) );
readfile ( $file );
My problem is that if the URL contains a query string I don’t know how to pass that to the file.
http:///myswf.swf?q1=test maps to C:\SWF\myswf.swf
header ( 'Content-Type: applicaton/x-shockwave-flash' );
header ( 'Content-Length: ' . filesize ( $file ) );
readfile ( $file );
fails to pass the q1 parameter to the SWF.
I can’t tinker with the SWF.
How should I call the SWF and successfully pass the parameters from within PHP?
The SWF file is not executed on the server. As such, you cannot “pass” anything to the SWF file. The file is simply downloaded by the client and then run in the browser, which is were it will get the URL parameters. From the client side, this looks like this (simplified):
As long as the process works like this on the client side, it doesn’t matter how exactly you serve the file.