Skip to content

Instantly share code, notes, and snippets.

@argrath
Created November 16, 2019 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save argrath/cd73225417f926ad6214f9905ed6714a to your computer and use it in GitHub Desktop.
Save argrath/cd73225417f926ad6214f9905ed6714a to your computer and use it in GitHub Desktop.
Win32::Internetでhttpsアクセスするテスト。httpでアクセスしてもhttpsにリダイレクトするサイトならこのままで動く?
use strict;
use warnings;
use Win32::Internet;
my $REQ;
my $HTTP;
my $INET = new Win32::Internet();
$INET->HTTP($HTTP, "gmail.com");
$HTTP->OpenRequest($REQ, "/");
$REQ->AddHeader("If-Modified-Since: Saturday, 16-Nov-96 15:58:50 GMT");
$REQ->SendRequest();
my $statuscode = $REQ->QueryInfo("",HTTP_QUERY_STATUS_CODE);
my $lastmodified = $REQ->QueryInfo("Last-Modified");
my $file = $REQ->ReadEntireFile();
$REQ->Close();
$HTTP->Close();
print $file;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment