[olug] get web server host name

Matthew Platte 51 at triopticon.com
Thu Apr 10 20:16:58 UTC 2008


On Thu, 2008-04-10 at 14:26 -0500, Mr Scsi wrote:
> Anyone have any quick and dirty perl ways to get the name of the server that
> serviced a http request?

I don't speak the Perl, much.  If you have Ruby/IRB this might be what
you're asking for:

matt at blacksmith:~/$ irb
irb(main):001:0> require 'socket'
=> true
irb(main):002:0> target=TCPSocket.gethostbyname('www.reboottheuser.com')
=> ["wsip-70-168-35-116.om.om.cox.net", [], 2, "70.168.35.116"]
irb(main):003:0> 

-- 
-------^.^--




More information about the OLUG mailing list