+ -
当前位置:首页 → 问答吧 → 用WWW::Curl获得页面内容

用WWW::Curl获得页面内容

时间:2010-12-31

来源:互联网

在使用WWW::Curl的时候,看perldoc WWW::Curl里他这样用:
  1. use strict;
  2. use warnings;
  3. use WWW::Curl::Easy;
  4. # Setting the options
  5. my $curl = new WWW::Curl::Easy;
  6. $curl->setopt(CURLOPT_HEADER,1);
  7. $curl->setopt(CURLOPT_URL, 'http://example.com');

  8. my $response_body;
  9. # NOTE - do not use a typeglob here. A reference to a typeglob is okay though.
  10. open (my $fileb, ">", \$response_body);
  11. $curl->setopt(CURLOPT_WRITEDATA,$fileb);
  12. # Starts the actual request
  13. my $retcode = $curl->perform;
复制代码
但是我得不到页面内容呀,有谁知道这个怎么用吗?

作者: bernana   发布时间: 2010-12-31

CURL还有Perl封装,不错。。不过没用过,回答不了

作者: bluewaterray   发布时间: 2011-01-02