1
codeigniterフレームワークでgoogleを使用してログインしようとしています。 以前はうまくいきました。同じコードで以下のエラーメッセージが表示されます。 どうすればこの問題を解決できますか?サーバーでホストされた後メッセージ:HTTPエラー:(0)accounts.google.comへの接続に失敗しました。ポート80:接続がタイムアウトしました
localhostが、それは誤り以下
Type: apiIOException
Message: HTTP Error: (0) Failed to connect to accounts.google.com port 80: Connection timed out
Filename: application/third_party/google-login-api/io/apiCurlIO.php
下に示したエラー
An uncaught Exception was encountered
Type: apiIOException
Message: HTTP Error: (0) Unsupported proxy scheme for 'https://accounts.google.com/o/oauth2/token'
Filename: application\third_party\google-login-api\io\apiCurlIO.php
の下に示して、私のカールスクリプトはこれを解決する方法
$ch = curl_init();
curl_setopt($ch, CURLOPT_PROXY, $request->getUrl()); //your proxy url
curl_setopt($ch, CURLOPT_PROXYPORT, "80"); // your proxy port number
curl_setopt_array($ch, self::$DEFAULT_CURL_PARAMS);
curl_setopt($ch, CURLOPT_URL, $request->getUrl());
if ($request->getPostBody()) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $request->getPostBody());
}
$requestHeaders = $request->getRequestHeaders();
if ($requestHeaders && is_array($requestHeaders)) {
$parsed = array();
foreach ($requestHeaders as $k => $v) {
$parsed[] = "$k: $v";
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $parsed);
}
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $request->getRequestMethod());
curl_setopt($ch, CURLOPT_USERAGENT, $request->getUserAgent());
$respData = curl_exec($ch);
// Retry if certificates are missing.
if (curl_errno($ch) == CURLE_SSL_CACERT) {
error_log('SSL certificate problem, verify that the CA cert is OK.'
. ' Retrying with the CA cert bundle from google-api-php-client.');
curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacerts.pem');
$respData = curl_exec($ch);
}
$respHeaderSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$respHttpCode = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curlErrorNum = curl_errno($ch);
$curlError = curl_error($ch);
curl_close($ch);
if ($curlErrorNum != CURLE_OK) {
throw new apiIOException("HTTP Error: ($respHttpCode) $curlError");
}
のですか?
@DanielStenbergあなたは更新された質問をご覧ください。サーバーにファイルをアップロードしたときに、エラーメッセージが –
"accounts.google.comポート80への接続に失敗しました"に変更されました。それが言うことを正確に意味します。 curlがそのマシンのホスト "accounts.google.com"のTCPポート80に接続できませんでした。ネットワークの設定、ファイアウォールなどのため。 –
@DanielStenbergどのようにサーバーにファイアウォールがあるかどうかを確認できますか?何が私のリクエストをブロックしていますか? –