1

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...

2 Answers 2

1

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');
Sign up to request clarification or add additional context in comments.

6 Comments

Actually my problem is that I can't get the parameter param1 in my component1.swf when it is loaded by the php file. One solution is to set the parameter in the attribute flashvar in tag object but I lose in modularity... Thanks for answer
Can't you use a rewrite rule to rewrite the hash parameter to the param1 parameter? Or are the two parameters of different values?
echo file_get_contents($file.'?param1=97df5ea7342b7e55b7ef3d402b585d1a'); doesn't works. I think, they are no solution to send flashvar by php...
Is file a filepath on your server or a URL? How exactly do you try to integrate the flash into your file. Can you provide us a full example?
$file is a URL. I have a web page which contains : <object ...> ... <param name="movie" value="127.0.0.1/widget.php?hashWidget=7e564vcfdfdf564gecd" /> ... <embed src="127.0.0.1/widget.php?hashWidget=7e564vcfdfdf564gecd" ...></embed> </object> widget.php will load the flash based on the parameter hashWidget But the flash file is dynamic, I have to pass parameters. In flash we could pass parameter like this : "127.0.0.1/flash.swf?param=helloworld". The problem is that the parameter is not passed through widget.php
|
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.