Reputation: 1071
I load Flash file using PHP.
test.php :
$widget = WidgetFactory::getInstanceByHash($_GET['hash']);
$file = $widget->getUrl();
$_GET['param1'] = "97df5ea7342b7e55b7ef3d402b585d1a";
header("Content-Type: application/x-shockwave-flash");
readfile($file);
The url of $file is for example : "http://adresse/component1.swf?param1=XXX"
If I type "http://adresse/test.php?hash=XXXXXXXXXXXXX" in my browser, I can see the flash file WITHOUT the parameter param1.
I tried to add : $_GET['param1'] = "97df5ea7342b7e55b7ef3d402b585d1a";
But it doesn't works.
So, I want to know if it is possible to add parameters by using header function...
Upvotes: 1
Views: 2197
Reputation: 9387
A GET parameter is a parameter set by the HTTP_REQUEST
but the header()
function sets parameters of the HTTP_RESPONSE
so there are never GET parameters in the response.
What is the actual problem with your code? How should the result look like?
EDIT: You might try to get the file using file_get_contents() or curl() appending the parameter:
echo file_get_contents($file.'?param1=97df5ea7342b7e55b7ef3d402b585d1a');
Upvotes: 1
Reputation: 48357
I'm not sure I understand what you are trying to say here.
If you try this:
<?php
header("Content-Type: application/x-shockwave-flash");
readfile("http://adresse/component1.swf?param1=97df5ea7342b7e55b7ef3d402b585d1a");
?>
Then I expect you will get what you are looking for. $_GET is a parsed copy of the CGI parameters passed in a URL. If you overwrite this in PHP it doesn't change the CGI parameters which were passed to the script. And the CGI parameters passed to the script have nothing to do with the parameters passed in a subsequent HTTP call unless you explicitly include them in the URL.
C.
Upvotes: 0