Forum: Ruby Switch User Agent

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2e3d01ef4f4cb07809aaacf837b0d006?d=identicon&s=25 Alex Amat (alexamat)
on 2005-12-07 14:59
Hi all I'm writing an application in ruby and I need to change the
UAProof of an HTTP request that I'm sending out. (To pretend that my
browser is a mobile phone) does anyone know how to go about it.

Many thanks
9dfe8c734b0f9b37a4e218425c0a2138?d=identicon&s=25 gene.tani (Guest)
on 2005-12-07 15:25
(Received via mailing list)
Alex Amat wrote:
> Hi all I'm writing an application in ruby and I need to change the
> UAProof of an HTTP request that I'm sending out. (To pretend that my
> browser is a mobile phone) does anyone know how to go about it.
>
> Many thanks
>
> --
> Posted via http://www.ruby-forum.com/.

I haven't seent the term UAproof before, but the open-uri and Net::HTTP
ways of opening URLs are both dict-like as far as passing User-Agents
etc:

http://www.ruby-doc.org/stdlib/libdoc/open-uri/rdoc/

e.g.
Net::HTTP.start( 'www.digg.com', 80 ) do |http|
print( http.get( '/', "User-Agent" => "foobar" ).body ) ; end

setting referrer/referer (can't remember which is correct!) is similar
9dfe8c734b0f9b37a4e218425c0a2138?d=identicon&s=25 gene.tani (Guest)
on 2005-12-07 15:25
(Received via mailing list)
Gene Tani wrote:
> I haven't seent the term UAproof before, but the open-uri and Net::HTTP
> ways of opening URLs are both dict-like as far as passing User-Agents
> etc:
>
> http://www.ruby-doc.org/stdlib/libdoc/open-uri/rdoc/
>
> e.g.
> Net::HTTP.start( 'www.digg.com', 80 ) do |http|
> print( http.get( '/', "User-Agent" => "foobar" ).body ) ; end
>
> setting referrer/referer (can't remember which is correct!) is similar

whoops, forgot the great zenspider slides:
http://www.zenspider.com/dl/rubyconf2005/open-uri.pdf
2e3d01ef4f4cb07809aaacf837b0d006?d=identicon&s=25 Alex Amat (alexamat)
on 2005-12-07 16:00
Sorry mate I meant User Agent (I'm a bit new to the world of ruby and
internet)
What I'm doing is a web site that changes normal PC websites into MCS
sites I've got three ifreams so that the rendered sites can be
previewed, all I need to do is change the user agent of the request
object so that my application delivers the content for different user
agents.

Thanks a lot !

gene.tani wrote:
> Gene Tani wrote:
>> I haven't seent the term UAproof before, but the open-uri and Net::HTTP
>> ways of opening URLs are both dict-like as far as passing User-Agents
>> etc:
>>
>> http://www.ruby-doc.org/stdlib/libdoc/open-uri/rdoc/
>>
>> e.g.
>> Net::HTTP.start( 'www.digg.com', 80 ) do |http|
>> print( http.get( '/', "User-Agent" => "foobar" ).body ) ; end
>>
>> setting referrer/referer (can't remember which is correct!) is similar
>
> whoops, forgot the great zenspider slides:
> http://www.zenspider.com/dl/rubyconf2005/open-uri.pdf
This topic is locked and can not be replied to.