laravel11 使用Http::get 连企业微信URL,就报tls1.2 不支持,直接使用guzzlehttp就可以,请教
环境: centos7.9 / laravel 11 / php8.2 / nginx1.18
问题:
$url = 'https://qyapi.weixin.qq.com/cgi-bin/gettoken';
Http::get($url, [
'corpid' => 'xxx',
'corpsecret' => 'xxx'
])->json();
这样,会报错:
InvalidArgumentException
Invalid crypto_method request option: TLS 1.2 not supported by your version of cURL
如果直接使用guzzlehttp,就能正常:
$url = 'https://qyapi.weixin.qq.com';
$client = new Client([
'base_uri' => 'https://qyapi.weixin.qq.com'
]);
return $client->get('/',['http_errors'=>false])->getStatusCode();
就能正常返回(403代码)
完全不懂,这个要砸配置,才能使用http门面方式,或者是不是大家都是直接使用guzzlehttp ?
加个
withOptions(['crypto_method' => null])
试试跟下面这个 PR 有关