On Tue, Dec 10, 2013 at 5:01 PM, Eduardo Nunes <lists / ruby-forum.com> wrote=
:
> "Jes=FAs Gabriel y Gal=E1n" <jgabrielygalan / gmail.com> wrote in post
> #1130261:
>> On Tue, Dec 10, 2013 at 4:54 PM, Eduardo Nunes <lists / ruby-forum.com>
>> 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.
>
> --
> 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.