# Making Rails interract with external sites / JS processing

**URL:** <https://www.ruby-forum.com/t/making-rails-interract-with-external-sites-js-processing/184884>\
**Category:** Rails\
**Created:** [March 9, 2010, 11:37pm UTC](https://www.ruby-forum.com/t/making-rails-interract-with-external-sites-js-processing/184884 "2010-03-09T23:37:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![twp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c89c15/32.png) [@twp](https://www.ruby-forum.com/u/twp)\
**Post date:** [March 9, 2010, 11:37pm UTC](https://www.ruby-forum.com/t/making-rails-interract-with-external-sites-js-processing/184884/1 "2010-03-09T23:37:13Z")

</div>

For some hobby project of mine I am trying to come up with a way to let  
a Rails application interact with some external website.

I am trying to achieve the following. Lets for example take a banner on  
a website. Which is the easiest to explain.  
Banners usually are on the same spot on websites, and when you click  
them, you get bounced to a couple of URLs before you end up at the  
company’s website whos ad you clicked.  
I want to automate this process!

Imagine the following scenario:

- I tell my Rails site to click a certain link/banner on a certain  
(external) website. Maybe through a DOMID, maybe through XPATH, im not  
certain on this yet.
- The server will need to retrieve / load the external page through a  
GET and then do another GET on the link I wanted to click.
- The server needs then to follow and gather all the links that it is  
bounced to, before ending up at the final site.

How would I achieve this using Ruby on Rails?

Then there is an added problem:

If we take the same example using banners again, some banners are  
rendered through JavaScript, such as Google Ads. The website HTML which  
we GET does not contain the banners, but the JS on that page tells the  
browser to fetch banners from Google directly.  
For this to work in my project I need some kind of server-side  
JavaScript processing scheme to make the banners show up on the server  
side, before we can click any links and follow their hops.

Any advice is greatly appreciated!

---

<div class="post-metadata">

**Author:** ![twp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c89c15/32.png) [@twp](https://www.ruby-forum.com/u/twp)\
**Post date:** [March 11, 2010, 4:13pm UTC](https://www.ruby-forum.com/t/making-rails-interract-with-external-sites-js-processing/184884/2 "2010-03-11T16:13:13Z")

</div>

Bump… Anyone?
