我怎样才能使用Perl动态网页内容? [英] How can I get dynamically web content using Perl?

查看:338
本文介绍了我怎样才能使用Perl动态网页内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是棘手的一种。有了这个网页当中,我猜,使用某种类型的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 和<一href="http://search.cpan.org/dist/Test-WWW-Selenium/lib/WWW/Selenium.pm"><$c$c>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?".

这篇关于我怎样才能使用Perl动态网页内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆