Net::HTTP.get(...) not working (still)

  • Thread starter Lady Michelle Bhaal
  • Start date
L

Lady Michelle Bhaal

Now that I've got my DNS back, I'm still getting the same basic error I
had last time around, complaining: undefined method 'line'

Help?

---

def fromWeb(site, url)
# get data from website
h = Net::HTTP.new(site, 80)
resp=h.get(url) do
# process data
|line|
if /DGM_navigation/ =~ line do
# decode page lineage
step=Array.new
astep, line = getNextWord(line)
while astep != nil
step.push(astep)
astep, line = getNextWord(line)
end
puts "Page Lineage"
indent = 0
step.each do
|astep|
indent.each do
put " "
end
puts astep
indent += 1
end
end # end DGM_naviation
end # end Net::HTTP.get
end # end def fromWeb
 
L

Logan Capaldo

------=_Part_24511_20244766.1132583313344
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Now that I've got my DNS back, I'm still getting the same basic error I
had last time around, complaining: undefined method 'line'

Help?

---

def fromWeb(site, url)
# get data from website
h =3D Net::HTTP.new(site, 80)
resp=3Dh.get(url) do
# process data
|line|
if /DGM_navigation/ =3D~ line do
# decode page lineage
step=3DArray.new
astep, line =3D getNextWord(line)
while astep !=3D nil
step.push(astep)
astep, line =3D getNextWord(line)
end
puts "Page Lineage"
indent =3D 0
step.each do
|astep|
indent.each do
put " "
end
puts astep
indent +=3D 1
end
end # end DGM_naviation
end # end Net::HTTP.get
end # end def fromWeb
Minor syntax error on your part

if's syntax is
if cond
...
end

not

if cond do # calls cond with the block
...
end

------=_Part_24511_20244766.1132583313344--
 

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

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,249
Latest member
KattieCort

Latest Threads

Top