更新时间:2022-05-19 05:34:33
您不能将用户名和密码放在$ host本身中.您首先需要手动在base64中对它们进行编码,然后将结果字符串添加到Proxy-Authorization标头中.
You cant put your username and password in the $host itself. You need to first encode them in base64 by hand and add the resulting string in the Proxy-Authorization header.
$ echo -n user:pass | openssl enc -a
dXNlcjpwYXNz
然后将此行添加到标题:
Then add this line to your header:
my $request;
my $host = '<proxyip>'; #EDITED
my $port = '<proxyport>';
my $headers = { ...
'Accept-Language'=> 'en-us,en;q=0.5',
'Accept-Charset'=> 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'Keep-Alive' => 300,
'Proxy-Authorization'=>'Basic dXNlcjpwYXNz' #EDITED
};
$request = http_request(
GET => $url,
timeout => 120, # seconds
headers => $headers,
proxy => [$host, $port],
mymethod
那应该可以了!