I would like to be able to use a http request tool (such as capybara or http party or simply plain ol’ simple ruby) to authenticate a user against a third party site.
The flow would be: User visits site A, logs on and navigates to siteA.com/foo which contains some simple info about them. User then visits site B. I’d like to pull the info from the foo page to display this.
- Automated tool visits siteA.com/foo (already logged on as user has already been there)
- Gets content of div with id bar
- Displays content to user on siteB.com
My question is – is this possible? Or should I stop wasting my time? I have no control over site A, except that I can control the markup.
Does the owner of site A not provide an API from which you can collect the data that you want?
You can use something like faraday to provide authentication to pull data from site A, then save it however you like (as raw markup in an object, if you wish) and show it on site B.
I guess the next question of where your ruby code will be running (as part of site B, or on a server completely separate from either site?), and how you’re going to get the data from the ruby code over to site B. Simply authenticating, and reading/parsing in the data on site A is pretty easy on its own.