質問するログイン新規登録

質問編集履歴

2

追加で色々やってみました。

2020/09/05 18:40

投稿

h5x
h5x

スコア11

title CHANGED
File without changes
body CHANGED
@@ -42,4 +42,38 @@
42
42
  print F $source;
43
43
  close F;
44
44
  print $source;
45
+ ```
46
+
47
+
48
+ Perl本体やモジュールがおかしいのか気になり、コードを以下に書き換え、strawberry-perl(Portable)と上記のActivePerlで試して見ました。それぞれ以下のエラーが表示されました。
49
+ なお、opensslは
50
+ Win64OpenSSL_Light-1_0_0e.exe
51
+ Win64OpenSSL-1_1_1g.exe
52
+ Win64OpenSSL_Light-1_1_1g.msi
53
+ をそれぞれ試してみましたが無理でした。
54
+
55
+ strawberry-perl(Portable)
56
+ Can't connect to yahoo.jp:443 (Bad file descriptor)
57
+ Bad file descriptor at C:/PortableApp/strawberry-perl-5.32.0.1-64bit-PDL/perl/vendor/lib/LWP/Protocol/http.pm line 50.
58
+
59
+ ActivePerl
60
+ Can't connect to yahoo.jp:443
61
+ Bad file descriptor at C:/Perl/site/lib/LWP/Protocol/http.pm line 46.
62
+
63
+ ```perl
64
+ use strict;
65
+ #use Mozilla::CA;
66
+ use LWP::UserAgent;
67
+ my $ua = LWP::UserAgent->new;
68
+ #$ua->ssl_opts( verify_hostname => 0 );
69
+ # $ua->ssl_opts( SSL_ca_file => Mozilla::CA::SSL_ca_file() );
70
+ my $url;
71
+ $url = "http://yahoo.jp/";
72
+ $url = "https://yahoo.jp/";
73
+ my $res = $ua->get($url);
74
+ my $source = $res->content;
75
+ open(F,">test.html");
76
+ print F $source;
77
+ close F;
78
+ print $source;
45
79
  ```

1

誤字

2020/09/05 18:40

投稿

h5x
h5x

スコア11

title CHANGED
File without changes
body CHANGED
@@ -8,7 +8,7 @@
8
8
  use WWW::Mechanize;
9
9
  my $ua = WWW::Mechanize->new( autocheck => 1 );
10
10
  # $ua->ssl_opts( verify_hostname => 0 );
11
- $ua->get("http://yahoo.jp/");
11
+ $ua->get("https://yahoo.jp/");
12
12
  my $source = $ua->content;
13
13
  open(F,">test.html");
14
14
  print F $source;
@@ -25,7 +25,7 @@
25
25
  use WWW::Mechanize;
26
26
  my $ua = WWW::Mechanize->new( autocheck => 1 );
27
27
  $ua->ssl_opts( verify_hostname => 0 );
28
- $ua->get("https://yahoo.jp/");
28
+ $ua->get("http://yahoo.jp/");
29
29
  my $source = $ua->content;
30
30
  open(F,">test.html");
31
31
  print F $source;