PDA

View Full Version : Pass IP from PHP to Flash?


aeohn
10-28-2005, 03:10 AM
Hello, I've been digging through the forum and haven't found this mentioned so if you have, please forgive me for reasking.

But, basically what I'm trying to do is pass the user IP to my flash applet from PHP.

Now, I don't know if an HTML command that I could use to pass the variable by LoadVars so I'm figuring out the IP in PHP. I just need to get it into Flash from there.

My PHP file is called first (e.g. http://www.mydomain.com/getip.php) with the embed variables around it of course.

This loads this PHP file:

<?
$FILEOUT=file_get_contents("iptest.swf?theip=".$_SERVER['REMOTE_ADDR']);
echo $FILEOUT;
?>

Very short and simple but 'that' doesn't work. Anyone know how to dynamically create a variable in PHP then send it, inline, to flash?

Now, I could use SendandLoad from within the applet but I would REALLY prefer not to do that as this would require another PHP file. The app will be used by 10s of thousands of people and I would like to keep the total number of files as small as possible (1 PHP file 1 Flash App).

Or better yet, (wishful thinking) is there a way to get the IP from within flash!?

Any help would be greatly appreciated!

Cota
10-29-2005, 03:23 AM
If you're embedding the flash file in the PHP file that will be getting the IP address, then you could use Flashvars to pass the IP into flash. Other than loading the external PHP with loadvars, I'm not sure how else you could get it in there.

aeohn
10-29-2005, 08:31 AM
That's exactly what I'm doing... how do I pass LoadVars from within PHP? Flash I pretend to know, PHP I'm a novice.

Cota
10-29-2005, 04:01 PM
Here:
http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_16417