Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Net::HTTP and submitting forms
charlie bowman
2/23/2006 11:14:00 PM
I have a little snippet of code I wrote but it doesn't go to the correct
page. The script pulls the data off of index.php but not
index.php?pid=fact&person=chuck. What am I doing wrong?
require 'net/http'
res = Net::HTTP.post_form(URI.parse('
http://www.4q.cc/inde...
),
{'pid'=>'fact', 'person'=>'chuck'})
puts res.body
charlie bowman
recentrambles.com
--
Posted via
http://www.ruby-...
.
2 Answers
Adam Keys
2/24/2006 5:31:00 PM
0
On Feb 23, 2006, at 5:13 PM, charlie bowman wrote:
> I have a little snippet of code I wrote but it doesn't go to the
> correct
> page. The script pulls the data off of index.php but not
> index.php?pid=fact&person=chuck. What am I doing wrong?
>
> require 'net/http'
> res = Net::HTTP.post_form(URI.parse('
http://www.4q.cc/inde...
),
> {'pid'=>'fact', 'person'=>'chuck'})
> puts res.body
#post_form will put the parameters you pass in the request body. If
your PHP script doesn't care about GET or POST, you could make the
request like any other GET, appending ?pid=fact&person=chuck to your
URL.
--
~akk
http://there...
Charlie Bowman
2/24/2006 7:49:00 PM
0
Thank you. The following worked fine.
res =
Net::HTTP.get(URI.parse('
http://www.4q.cc/index.php?pid=fact&person=...
))
puts res
On Sat, 2006-02-25 at 02:31 +0900, Adam Keys wrote:
> On Feb 23, 2006, at 5:13 PM, charlie bowman wrote:
> > I have a little snippet of code I wrote but it doesn't go to the
> > correct
> > page. The script pulls the data off of index.php but not
> > index.php?pid=fact&person=chuck. What am I doing wrong?
> >
> > require 'net/http'
> > res = Net::HTTP.post_form(URI.parse('
http://www.4q.cc/inde...
),
> > {'pid'=>'fact', 'person'=>'chuck'})
> > puts res.body
>
> #post_form will put the parameters you pass in the request body. If
> your PHP script doesn't care about GET or POST, you could make the
> request like any other GET, appending ?pid=fact&person=chuck to your
> URL.
>
> --
> ~akk
>
http://there...
>
>
>
>
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Net::HTTP and submitting forms
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password