HTTP Headers

Hey guys, I need to make a HTTP GET in a page, but I need to use the
header X-Requested-With : XMLHttpRequest, but I have no idea how to do
this.
by the way I’m new in ruby.

On Tue, Dec 10, 2013 at 4:54 PM, Eduardo N. [email protected]
wrote:

Hey guys, I need to make a HTTP GET in a page, but I need to use the
header X-Requested-With : XMLHttpRequest, but I have no idea how to do
this.
by the way I’m new in ruby.

I think we need more info to help you. You need to make a GET in a
page but you need to do it in Ruby? I’m not sure you really mean that.
Is it that you need to issue a GET request from within a web page
(then look at AJAX, javascript), or is it that you wan to use Ruby to
perform that request within a script, for example?

If it’s the last one, we might be able to help you if you tell us more
about it.

Jesus.

“Jesús Gabriel y Galán” [email protected] wrote in post
#1130261:

On Tue, Dec 10, 2013 at 4:54 PM, Eduardo N. [email protected]
wrote:

Hey guys, I need to make a HTTP GET in a page, but I need to use the
header X-Requested-With : XMLHttpRequest, but I have no idea how to do
this.
by the way I’m new in ruby.

I think we need more info to help you. You need to make a GET in a
page but you need to do it in Ruby? I’m not sure you really mean that.
Is it that you need to issue a GET request from within a web page
(then look at AJAX, javascript), or is it that you wan to use Ruby to
perform that request within a script, for example?

If it’s the last one, we might be able to help you if you tell us more
about it.

Jesus.

Yes, I want to use ruby to perform a request with that header, sorry for
my bad english.

2013/12/10 Jess Gabriel y Galn [email protected]

re also a number of gems to help with HTTP requests: mechanize,
httparty, etc, depending on what you want to

If I understood your problem correctly, maybe this gem could also be an
option:

https://github.com/jnunemaker/httparty


Thyago Barbosa Rodrigues [Natal-RN/Brasil]

“Who loves not wine, women and song,
remains a fool his whole life long”
(Martin Luther [Martinho Lutero], Telogo Alemo)

“Phantasie ist wichtiger als Wissen, denn Wissen ist begrenzt.” (Albert
Einstein)

On Tue, Dec 10, 2013 at 5:01 PM, Eduardo N. [email protected]
wrote:

page but you need to do it in Ruby? I’m not sure you really mean that.
my bad english.


Posted via http://www.ruby-forum.com/.

You can use the stdlib class Net::HTTP, see here an example of setting
a header:
http://www.ruby-doc.org/stdlib-2.0/libdoc/net/http/rdoc/Net/HTTP.html#class-Net::HTTP-label-Setting+Headers

There also a number of gems to help with HTTP requests: mechanize,
httparty, etc, depending on what you want to do.

Jesus.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs