But not when getting it with cgi. I'm very new at all of this, as is
probably obvious, but I can't figure this out. Any pointers in the right
direction would be appreciated.
CGI is a fickle little LIB, but she'll start to do your bidding once she
feels that you know what you are doing. Pay particular attention to the
<INPUT type="text" name ="link"> tag
If you don't specify NAME and use ID or some other thing, CGI wont read
your code right. At least that has been my experience.
If you just can't get CGI to read the form data, you can try to access
the data using ARGV as if the string was a command line variable to your
script.
The rule: certain characters have to be 'transformed' in order to pass
them in a query string attached to the end of a url. That means the
special characters have to be 'untransformed' on the other side.
A cursory examination of those strings reveals that they are not
identical.
The rule: certain characters have to be 'transformed' in order to pass
them in a query string attached to the end of a url. That means the
special characters have to be 'untransformed' on the other side.
Thanks for pointing out the unescape, something I hadn't thought of.
Unfortunately, as I'm using it at least, that didn't fix the problem. It
works when I do this:
I'm pretty sure the @linky = cgi['link'] is working because when I
remove the hpricot part of the code and just display the variable with a
puts @linky, I get the correct string as output.
Other than that, your code looks ok to me, so I would check your form
data. Something like the following should get recognized by cgi.
Just to be sure, I checked the form and it looks okay.
CGI is a fickle little LIB, but she'll start to do your bidding once she
feels that you know what you are doing.
Darn... that'll be a while
If you just can't get CGI to read the form data, you can try to access
the data using ARGV as if the string was a command line variable to your
script.
As noted below, cgi seems to be reading the string. I can read it and
display it with a:
puts @linky
but whenever i try to pass it along to hpricot, it gives me a server
error. Odd.
Other than that, your code looks ok to me, so I would check your form
data. Something like the following should get recognized by cgi.
Just to be sure, I checked the form and it looks okay.
CGI is a fickle little LIB, but she'll start to do your bidding once she
feels that you know what you are doing.
Darn... that'll be a while
If you just can't get CGI to read the form data, you can try to access
the data using ARGV as if the string was a command line variable to your
script.
As noted below, cgi seems to be reading the string. I can read it and
display it with a:
puts @linky
but whenever i try to pass it along to hpricot, it gives me a server
error. Odd.
What's the server error?
I installed eruby, and I was able to configure eruby to work with my own
Apache2 install on mac osx 10.4.11,
(per the instructions in pickaxe2 p. 243 (a sym link didn't work, I
actually had to copy the file into cgi-bin))
and despite my earlier post, your code works fine for me using Apache
and localhost, although you can use open() with a block, and then you
don't have to manually close the file: