一一个一个一一丶、↙、
请稍后重试!错误详情: Received HTTP/0.9 when 调用微信接口出现?$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$this->account['key']}&secret={$this->account['secret']}"; $content = ihttp_get($url); if(is_error($content)) { return error('-1', '获取微信公众号授权失败, 请稍后重试!错误详情: ' . $content['message']); } function ihttp_request($url, $post = '', $extra = array(), $timeout = 60) { if (function_exists('curl_init') && function_exists('curl_exec') && $timeout > 0) { $ch = ihttp_build_curl($url, $post, $extra, $timeout); if (is_error($ch)) { return $ch; } $data = curl_exec($ch); $status = curl_getinfo($ch); $errno = curl_errno($ch); $error = curl_error($ch); curl_close($ch); if ($errno || empty($data)) { return error($errno, $error); } else { return ihttp_response_parse($data); } } $urlset = ihttp_parse_url($url, true); if (!empty($urlset['ip'])) { $urlset['host'] = $urlset['ip']; } $body = ihttp_build_httpbody($url, $post, $extra); if ($urlset['scheme'] == 'https') { $fp = ihttp_socketopen('ssl://' . $urlset['host'], $urlset['port'], $errno, $error); } else { $fp = ihttp_socketopen($urlset['host'], $urlset['port'], $errno, $error); } stream_set_blocking($fp, $timeout > 0 ? true : false); stream_set_timeout($fp, ini_get('default_socket_timeout')); if (!$fp) { return error(1, $error); } else { fwrite($fp, $body); $content = ''; if($timeout > 0) { while (!feof($fp)) { $content .= fgets($fp, 512); } } fclose($fp); return ihttp_response_parse($content, true); } } function ihttp_get($url) { return ihttp_request($url); }
2021-08-22