RE: [flexcoders] Re: Getting client's IP address

2005-06-13 Thread Jeff Beeman
Thanks, all!  I will let you know if one of these works for us, but they
all sound like reasonable solutions :-)


/**
* Jeff Beeman
**/

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Andrew Spaulding
Sent: Monday, June 13, 2005 4:18 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Getting client's IP address

You could also pass it to your mxml file as a flashvar, as long as you
have the variable declared in your root application. I do something
similar to the following from within a jsp page:

!-- index.jsp --

html
head
titleflex/title

%@ taglib uri=FlexTagLib prefix=mm /

%
   String ipAddress = null;
   if( request.getHeader(X-Forwarded-For) == null )
   {
  ipAddress = request.getRemoteAddr();
   }
   else
   {
  ipAddress = request.getHeader(X-Forwarded-For);
   }
%

body

   mm:mxml source=myApp.mxml
  mm:flashvar name=IP_ADDRESS value=%= ipAddress % /
   /mm:mxml

/body

/html


Be sure to have the variable IP_ADDRESS declared in the root of your
mxml application.

Hope this helps,

Andrew
www.flexdaddy.com




--- In flexcoders@yahoogroups.com, heybluez [EMAIL PROTECTED]
wrote:
 Hi,
 
 I do this with a simple .jsp script in the Flex app.  You can include
 something like the following:
 
 getIPAddress.jsp:
 
 clientip
 valGet%=request.getRemoteAddr()%/valGet
 /clientip
 
 Then call that within Flex in an HTTPService and parse the return. 
 HTTPService.result.clientip.valGet , etc
 
 Then you can store that in a sharedobject or whatever you want.
 
 Hope it helps.
 
 -Michael
 
 --- In flexcoders@yahoogroups.com, temporal_illusion
 [EMAIL PROTECTED] wrote:
  I assume it's a http service you're using that calls the PHP page to
  get the IP?  I think the web service calls are proxied by default. 
  Try adding the useProxy=false property in the http service, that
  should tell the app to go to the web service directly.
  
  Jason
  
  --- In flexcoders@yahoogroups.com, Jeff Beeman [EMAIL PROTECTED]
  wrote:
   We've got a Flex app that is calling a PHP script to retrieve the
   end-user's IP address (for an authentication procedure), but the
IP
   address that is returned is the address of the Flex server, not
the
   client.  Any thoughts on why this is happening?  And, how do we
work
   around it?
   

   

   
   /***
   * Jeff Beeman
   * Digital Media  Instructional Technologies
   * Arizona State University
   ***/





 
Yahoo! Groups Links



 






 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




RE: [flexcoders] Re: Getting client's IP address

2005-06-13 Thread Jeff Steiner










FYI: Someone contributed an example of
this to the site this morning. I just posted it and you can find it: http://www.flexauthority.com/samplesIndex.cfm?sampleID=39



Let me know if that helps.





Jeff

Founder

Flex Authority

http://www.flexauthority.com



We are actively seeking contributors for
the site. Have a sample that you want to share with the world? Send
it to us!











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Jeff Beeman
Sent: Monday, June 13, 2005 4:42
PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Re:
Getting client's IP address





Thanks, all! I will let you know if one of these works for us,
but they
all sound like reasonable solutions :-)


/**
* Jeff Beeman
**/

-Original Message-
From: flexcoders@yahoogroups.com
[mailto:flexcoders@yahoogroups.com]
On
Behalf Of Andrew Spaulding
Sent: Monday, June 13, 2005 4:18 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Getting client's IP
address

You could also pass it to your mxml file as a
flashvar, as long as you
have the variable declared in your root
application. I do something
similar to the following from within a jsp page:

!-- index.jsp --

html
head
titleflex/title

%@ taglib uri=FlexTagLib
prefix=mm /

%
 String ipAddress = null;
 if(
request.getHeader(X-Forwarded-For) == null )
 {
 ipAddress =
request.getRemoteAddr();
 }
 else
 {
 ipAddress =
request.getHeader(X-Forwarded-For);
 }
%

body

 mm:mxml
source=myApp.mxml
 mm:flashvar
name=IP_ADDRESS value=%= ipAddress % /
 /mm:mxml

/body

/html


Be sure to have the variable
IP_ADDRESS declared in the root of your
mxml application.

Hope this helps,

Andrew
www.flexdaddy.com




--- In flexcoders@yahoogroups.com,
heybluez [EMAIL PROTECTED]
wrote:
 Hi,
 
 I do this with a simple .jsp script in the
Flex app. You can include
 something like the following:
 
 getIPAddress.jsp:
 
 clientip
 valGet%=request.getRemoteAddr()%/valGet
 /clientip
 
 Then call that within Flex in an HTTPService
and parse the return. 
 HTTPService.result.clientip.valGet , etc
 
 Then you can store that in a sharedobject or
whatever you want.
 
 Hope it helps.
 
 -Michael
 
 --- In flexcoders@yahoogroups.com,
temporal_illusion
 [EMAIL PROTECTED] wrote:
  I assume it's a http service you're
using that calls the PHP page to
  get the IP? I think the web
service calls are proxied by default. 
  Try adding the
useProxy=false property in the http service, that
  should tell the app to go to the web
service directly.
  
  Jason
  
  --- In flexcoders@yahoogroups.com,
Jeff Beeman [EMAIL PROTECTED]
  wrote:
   We've got a Flex app that is
calling a PHP script to retrieve the
   end-user's IP address (for an
authentication procedure), but the
IP
   address that is returned is the
address of the Flex server, not
the
   client. Any thoughts on why
this is happening? And, how do we
work
   around it?
   
   
   
   
   
  
/***
   * Jeff Beeman
   * Digital Media  Instructional
Technologies
   * Arizona State
 University
   ***/






Yahoo! Groups Links




















Yahoo! Groups Links

To visit your group on the web, go to:http://groups.yahoo.com/group/flexcoders/
To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.