I am new to ruby and have been struggeling with this http api thing. I
need to do a request with certian request headers, certain post
variables and SSL.
I got it to work with SSL and the headers, but I just cant get it to
work when i try to cenvert it to post. Very frustrating.
Heres how far i got (this is without post, which i couldnt get to work):
You can try Mechanize, it works for me like a charm.
···
On Wed, Apr 13, 2011 at 2:11 PM, Stuffe L. <stuffe.dk@gmail.com> wrote:
Hello everyone
I am new to ruby and have been struggeling with this http api thing. I
need to do a request with certian request headers, certain post
variables and SSL.
I got it to work with SSL and the headers, but I just cant get it to
work when i try to cenvert it to post. Very frustrating.
Heres how far i got (this is without post, which i couldnt get to work):
I am new to ruby and have been struggeling with this http api thing. I
need to do a request with certian request headers, certain post
variables and SSL.
I got it to work with SSL and the headers, but I just cant get it to
work when i try to cenvert it to post. Very frustrating.
Heres how far i got (this is without post, which i couldnt get to work):
@7stud, I copied the code out of a function and tried to simplify it for
you guys to read But I must have forgot what you said.
But if you do as in your example, the contents of the data variable will
be send as a part of the query string no? Therefore it will still a get
and I know that works sometimes, but in this particular case it MUST be
post!
@7stud, I copied the code out of a function and tried to simplify it for
you guys to read But I must have forgot what you said.
But if you do as in your example, the contents of the data variable will
be send as a part of the query string no?
No. This line:
resp = http.post(url.path, data, headers)
tells ruby to send a *post* request. POST requests do not include data
in the query string--they put the data in the body of the request. The
data still has to be in an agreed upon format, though, otherwise the
other side won't know how to split it up to make sense of the data.