WWW::Mechanize
に空白のコンテンツが含まれているのはなぜですか?ブラウザまたはcurl
を使用すると、完全なHTMLページが取得されます。ここで なぜWWW :: Mechanizeは "X-Died:不正なフィールド名"で失敗するのですか?X-Meta-Twitter:title '"?
use WWW::Mechanize;
$mech = new WWW::Mechanize;
$mech->get("http://www.belizejudiciary.org/web/judgements2/");
print $mech->content # prints nothing
は、応答のダンプです:
HTTP/1.1 200 OK
Connection: close
Date: Fri, 10 Feb 2017 00:51:47 GMT
Server: Apache/2.4
Content-Type: text/html; charset=UTF-8
Client-Aborted: die
Client-Date: Fri, 10 Feb 2017 00:51:48 GMT
Client-Peer: 98.129.229.64:80
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
Link: <http://www.belizejudiciary.org/web/wp-json/>; rel="https://api.w.org/"
Link: <http://www.belizejudiciary.org/web/?p=468>; rel=shortlink
Set-Cookie: X-Mapping-hepadkon=FAB86566672CEB74D66B2818CA030616; path=/
X-Died: Illegal field name 'X-Meta-Twitter:title' at /usr/local/lib/perl5/site_perl/5.16.3/sun4-solaris/HTML/HeadParser.pm line 207.
X-Pingback: http://www.belizejudiciary.org/web/xmlrpc.php
私はHTMLのバージョン3.70を持っている:: Parserがインストールされています。
私は何も得られません。どのバージョンのモジュールを使用していますか? 'Use Data :: Dumper;の内容は何ですか? print Dumper($ mech-> response) '? – choroba
@choroba私のシステムは 'HTML:Parser'のバージョン3.70を持っているので問題になるかもしれません。回答は私の編集を参照してください。 – CJ7
@choroba 'get'の前に' $ mech-> parse_head(0) 'を追加して問題を解決しました。この回答から:http://stackoverflow.com/a/17745491/327528 – CJ7