问题
Is it possible to get client IP address through Flash (swf) Action Script 3 and then pass it to php file to store it in database?
回答1:
No need to do it in flash, just do it on your server in php "$ip=@$REMOTE_ADDR;"
回答2:
No, the client IP address is not available in ActionScript 3. The recommended approach is to have it reflected by server-side code.
See http://www.actionscript.org/forums/showthread.php3?s=&threadid=20123
回答3:
function GetUserIP() {
var js="function get_userIP(){return java.net.InetAddress.getLocalHost().getHostAddress();}";
var userIPInfo:String=ExternalInterface.call(js).toString();
return userIPInfo;
}
回答4:
As I know YES!! But I am wondering about the reason of doing that. You can just use PHP for get the IP Address..
EDIT : Had a research.. Changing my answer. I think there is less possibility to do it with Flash..
回答5:
Like the above answer, use PHP (or other scripting language) to pass the IP address as a param value into your flash movie and you'll have it available at runtime.
Another option is to use the ExternalInterface to make a call to a server-side PHP script or something of the like to return the IP address.
回答6:
As Alex says, pass it in via flashvars, but that PHP should really be:
$_SERVER['REMOTE_ADDR']
The json extension is handy for wrIting out flash vars, e.g. for passing to swfobject:
var flashvars = { IP : <?=json_encode($_SERVER['REMOTE_ADDR'])?> };
回答7:
It is possible to grab the real IP address via Flash Actionscript.
You'll believe it after you visited this site (click on Flash tab):
http://AnalyzeMy.net
回答8:
Despite what most are saying - there is a difference somehow. I used to run a rather large forum (200k+) and most banned members were eventually caught again once they entered our chat (Flash). While the VB software (using php) would give one IP (Usually through a Proxy/Network) , the Chat (Flash) would in fact give us their True IP. Don't ask me to explain it - I barely get by with PHP myself ...
来源:https://stackoverflow.com/questions/695854/get-ip-address-using-action-script