# Visit a url programatically

**URL:** <https://www.ruby-forum.com/t/visit-a-url-programatically/188352>\
**Category:** Rails\
**Created:** [May 10, 2010, 5:28pm UTC](https://www.ruby-forum.com/t/visit-a-url-programatically/188352 "2010-05-10T17:28:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@kevid](https://www.ruby-forum.com/u/kevid)\
**Post date:** [May 10, 2010, 5:28pm UTC](https://www.ruby-forum.com/t/visit-a-url-programatically/188352/1 "2010-05-10T17:28:52Z")

</div>

hi all,

i have the code below;

require ‘rexml/document’  
require ‘open-uri’  
open(‘[http://api.evdb.com/rest/users/login?app\_key=ct2hJqTCg4XLCP5h](http://api.evdb.com/rest/users/login?app_key=ct2hJqTCg4XLCP5h)’)  
{ |f|  
$res = REXML::Document.new(f.read)

}

the xml data that is read is;

\<?xml version="1.0" encoding="UTF-8"?\> 6984053721 Please supply a user authentication response using the nonce provided.

QUESTIONS

1. how do i get the value of nonce (i.e. 6984053721 )

2. is there another way of visiting the url “[http://api.evdb.com/](http://api.evdb.com/)  
rest/  
users/login?app\_key=ct2hJqTCg4XLCP5h”  
without using open-uri as in above

thoughts??

---

<div class="post-metadata">

**Author:** ![kevid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@kevid](https://www.ruby-forum.com/u/kevid)\
**Post date:** [May 10, 2010, 8:38pm UTC](https://www.ruby-forum.com/t/visit-a-url-programatically/188352/2 "2010-05-10T20:38:00Z")

</div>

kevid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> hi all,
> 
> i have the code below;
> 
> QUESTIONS
> 
> 1. how do i get the value of nonce (i.e. 6984053721 )

You should take a look at nokogiri [http://nokogiri.org/](http://nokogiri.org/)

> 1. is there another way of visiting the url “[http://api.evdb.com/](http://api.evdb.com/)  
> rest/  
> users/login?app\_key=ct2hJqTCg4XLCP5h”  
> without using open-uri as in above

There is the mechanize framework.

Jarl

---

<div class="post-metadata">

**Author:** ![kevid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@kevid](https://www.ruby-forum.com/u/kevid)\
**Post date:** [May 10, 2010, 8:40pm UTC](https://www.ruby-forum.com/t/visit-a-url-programatically/188352/3 "2010-05-10T20:40:56Z")

</div>

## There is a helpful railscast on mechanize here: [#191 Mechanize - RailsCasts](http://railscasts.com/episodes/191-mechanize)

Jason S.  
“I’m going to live forever or die trying.”
