nate11000 has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to automate checking futures prices on www.intrade.com. I can use HTTP:Request to grab the front page using this code:
use LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->agent("MyApp/0.1 "); my $req = HTTP::Request->new(POST => 'http://www.intrade.com/'); $req->content_type('application/x-www-form-urlencoded'); my $res = $ua->request($req); if ($res->is_success) { print OUT $res->content; }
The way the page is set up, though, I can't get to the actual pricing pages I'm looking for - only to the front page.

Excuse my web ignorance - I don't know much beyond simple html and cgi, so I don't even know what to call their setup, but the links on the page generally point to www.intrade.com/#. Also, if I open the source of the front page, the information stored in it is pretty useless - just a couple of meta tags with no real information (again, I apologize for my web ignorance).

What do I need to do or learn about in order to navigate through specific links to find and retrieve the page I want? I've tried looking through code for stock quote grabbing programs that I thought would be similar, but none of it was much help. I don't really know quite what I'm looking for, so a little direction would be very helpful.


Thanks!

Replies are listed 'Best First'.
Re: Web navigation
by friedo (Prior) on Nov 20, 2005 at 23:41 UTC
    Usually when the links don't actually point anywhere, it's because they've got some Javascript code that hooks into the click events and makes your browser fetch the next page. You may need to reverse engineer their javascript to figure out the links you need to go to.
      Thanks for the help! That doesn't sound like much fun - but I'll see what I can do.
Re: Web navigation
by steveAZ98 (Monk) on Nov 21, 2005 at 00:58 UTC

    I think what your looking for is this page:

    http://www.intrade.com/jsp/intrade/contractSearch/searchPageBuilder.jsp?grpID=3385

    Where grpID is one of the grpID's in:

    http://www.intrade.com/jsp/graph/groups.js?113253315

    I'm not sure if the number on the end changes. I'm also not sure if they built it this way to make it more difficult for you to mine their data, you might want check their rules.

    HTH,
    Steve
Re: Web navigation
by sk (Curate) on Nov 21, 2005 at 00:37 UTC
    I am not sure if I understand where you are going on that website but if you know how to get there manually then you should check out WWW::Mechanize.

    The module has sample code and very good documentation! Good luck!

    Cheers

    SK

Re: Web navigation
by kulls (Hermit) on Nov 21, 2005 at 03:54 UTC
    Hi,
    Did u check with the adminstrator of intrade.com to access their site.? Basically, if they are allowing external sites to read their contents, then they must have a specific url which will serve other needs. Better u can post the request to them, so that it's easy for you to proceed.
    -kulls
      Thanks for all the help. I found the basic info with just the url, but I think www:mechanize will get me to the level I'm hoping to get to. Thanks to everybody!