# Record Remote IP Address

**URL:** <https://www.ruby-forum.com/t/record-remote-ip-address/194376>\
**Category:** Rails\
**Created:** [September 3, 2010, 10:31am UTC](https://www.ruby-forum.com/t/record-remote-ip-address/194376 "2010-09-03T10:31:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tlangas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/22d042/32.png) [@tlangas](https://www.ruby-forum.com/u/tlangas)\
**Post date:** [September 3, 2010, 10:31am UTC](https://www.ruby-forum.com/t/record-remote-ip-address/194376/1 "2010-09-03T10:31:01Z")

</div>

I’ve seen several examples online about people wanting to record the  
visitors remote IP Address for their own reasons. In my case I want to  
record the IP address from a remote computer that uses a dynamic IP  
address. I need this information saved without user interaction. Right  
now I have a simple cron script set up on the remote servers that will  
open a text browser for a few seconds to a page hidden on my website.  
This way I can keep track of the remote ip address.

I currently have:  
def set\_current\_ip  
@remoteip = Remotetip.new  
@remoteip.dyn\_ip = request.env[‘REMOTE\_ADDR’]  
@remoteip.save  
end

And it works great. How ever I also need to record  
@remoteip.orgainization and @remoteip.host. My first thoughts were to  
use GET or POST and append the information on the end of the url. I’ve  
not used GET or POST for some time and could really use some help.

If anyone knows of a better solution I’m open for suggestions.

---

<div class="post-metadata">

**Author:** ![tlangas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/22d042/32.png) [@tlangas](https://www.ruby-forum.com/u/tlangas)\
**Post date:** [September 6, 2010, 4:39pm UTC](https://www.ruby-forum.com/t/record-remote-ip-address/194376/2 "2010-09-06T16:39:37Z")

</div>

I figured it out.

```
def set_current_ip
    if params[:organization] && params[:host]
            @getip = Getip.new
            @getip.organization = params[:organization]
            @getip.host = params[:host]
            @getip.dyn_ip = request.env['REMOTE_ADDR']
            @getip.save
    end
end

```

It works if I manually set the url to  
http :///remoteip\*?organization=mycompany&host=fileserver\*

It works for now and there is still a lot more I should do to this so I  
am  
still open for ideas.

Trevor
