我怎样才能使用Perl动态网页内容?动态网页、内容、Perl

2023-09-10 13:37:51 作者:骨子里的高雅

这是棘手的一种。有了这个网页当中,我猜,使用某种类型的AJAX的基础上,搜索查询拔出内容。当我取使用获取页面在Perl,它获取的PHP / HTML背后的脚本code,而不是其显示手动搜索查询时的结果。我需要能够抓取结果页面的内容。反正有做到这一点在Perl?

This is kind of tricky. There is this webpage which, I am guessing, uses some kind of AJAX to pull out content based on the search query. When I fetch the page using get in Perl, it fetches the script code behind the php/html, but not the results which are displayed when the query is searched manually. I need to be able to fetch the content of the results page. Is there anyway to do this in Perl?

推荐答案

看看硒RC 和WWW::Selenium在Perl模块。有了它们,你可以控制一个真正的Web浏览器。

Take a look at Selenium RC and the WWW::Selenium module in Perl. With them you can control a real web browser.

另一种选择是 WWW ::的HtmlUnit 的,它使用的HtmlUnit Java库来执行JavaScript而不Web浏览器。 WWW ::的HtmlUnit 使用内嵌::的Java 给Perl的进入图书馆。我发现在安装时,最好是说没有这个问题:你希望建立的JNI扩展?。

Another option is WWW::HtmlUnit which uses the HtmlUnit Java library to execute the JavaScript without a web browser. WWW::HtmlUnit uses Inline::Java to give Perl access to the library. I have found that when installing, it is best to say No to the question "Do you wish to build the JNI extension?".