From: Robert Klemme Date: 2010-03-04T21:48:56+09:00 Subject: Re: Url parsing in ruby 2010/3/4 John Ydil : > Robert Klemme wrote: >> 2010/3/4 John Ydil : >>> >>>> Maybe we should start over with you describing what you are trying to >>>> do. �Your initial posting read like "I have an URL and need to extract >>>> a particular part of it". �That's what Brian and I have answered. �I'm >>>> afraid, you'll probably have to provide more context or explain where >>>> exactly you are stuck. >> >>> Ok,I'm coding a web page with Ruby. >> >> And how do you interface with the web server?  If you are using Cgi you >> can use >> http://www.ruby-doc.org/stdlib/libdoc/cgi/rdoc/index.html > I think this lib is for generate html, I didn't see method to get the > URL This is not true. Please read the documentation I referred you to. > How it works : > I told my web server (apache) to use ruby (.rbx extension) Barring any other information I have to assume that this is the CGI interface. > In my web page, I use ruby to write html which is interpreted by apache. > It looks like : > mywebpage.rbx > > #!/usr/bin/env ruby > > print "Content-type: text/html\r\n\r\n" > require 'rubygems' > require 'net/ssh' > > HOST = '192.168.0.121' > USER = 'root' > PASS = 'xxxx' > > Net::SSH.start( HOST, USER, :password => PASS ) do|ssh| >  result = ssh.exec!('/root/checknas.rb --list') > print " Info " > print "{html stuff}" > print "" > end > > > Maybe I don't have the good way of doing this but at least, it works, my > web pages are displayed. Class CGI helps with creating valid HTML as well so I suggest you use it. It's just the proper tool for the job. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/