View Source Code in Whois.net

C

Chris Berry

I am trying to view the source code in whois.net using the following
code:


require 'open-uri'
open("http://whois.net/whois/qoxax.com") {|f|
text = f.read
lines = f.readlines
text = lines.join
text.gsub!(/\s+/," ")

puts text

}

The whois.net view source has TONS of whitespace at the beginning and
end which I am guessing is causing this to come up blank when I run this
code but perhaps you have better ideas / luck?
 
R

Redd Vinylene

[Note: parts of this message were removed to make it a legal post.]

gsub!(/>\s+</, '><') maybe?
 
J

Jack Bauer

Chris said:
The whois.net view source has TONS of whitespace at the beginning and
end which I am guessing is causing this to come up blank when I run this
code but perhaps you have better ideas / luck?

string.lstrip.rstrip will get rid of a lot of it.
 
M

Mark Thomas

Why are you trying to view the source? You're not planning to parse
HTML with regular expressions, are you? There are much better
libraries out there for that.

-- Mark.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top