- 企业微信开发调用getUserInfo 接口会间歇性报错: Failed to connect to qyapi.weixin.qq.com port 443: Connection timed out
- 不是所有请求都会报错,而是间歇性报错。比如有时候几百次请求中会有三四次报错。目前的临时解决办法是如果有报错就再重新去请求下接口,这样基本能暂时解决问题。
- 请求代码如下:
public static function vGet($access_token, $code)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?access_token=' . $access_token . '&code=' . $code);
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
curl_setopt($ch, CURLOPT_ACCEPT_ENCODING, "gzip,deflate");
$return_data = curl_exec($ch);
if($return_data === false)
{
\think\facade\Log::write('curl error' . curl_error($ch), 'error');
}
curl_close($ch);
\think\facade\Log::write('getUserInfo' . $return_data, 'debug');
return $return_data;
}
您好,请问调用到其他接口时是否也会有超时情况出现呢
遇到同样的问题,请问当时有最终定位到原因吗?
我也是觉得奇怪,经常出现请求不到数据的情况
curl返回的错误信息是 resolving timed out after 1509
错误码是 28
CURLE_OPERATION_TIMEDOUT (28)
Operation timeout. The specified time-out period was reached according to the conditions.
您好我们这边也遇到获取token接口超时情况,请问能帮忙查下什么原因吗?