开发者

Perl: Scraping a website with frames and javascript

I have a website with 2 frames. Actions performed in 1 frame(enter data in text box/select radio button/click a href) cause the other frame to load data with javascript. I need to be able to enter开发者_运维问答 data in the first frame and scrape the data in the second. What can I do for this?


Load the website in Firefox, then turn on the Firebug extension, enable the 'Net' tab, and have a look at the HTTP data being sent to and from the browser.

Sometimes it can help to try to forget what the webpage looks like, and concentrate on the posts and responses you see in Firebug's Net tab -- that's all you need to reproduce to get your data out.


You can either:

  1. Reverse engineer the JS (monitoring HTTP traffic can help) to figure out what data actually gets sent to the server and then replicate that in your Perl.
  2. Use WWW::Mechanize::Firefox to run a complete browser stack and interrogate it to read the results.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜