3

私のコードの一部は次のとおりです。

try {

    $client = new Google_Client();
    $client->setAuthConfig($credentials_file);

    $client->setAccessType("offline");
    $client->setIncludeGrantedScopes(true);
    $client->addScope("https://www.googleapis.com/auth/plus.business.manage");
}catch(GuzzleHttp\Exception\ConnectException $e){
    Connector::handleException($e); //just print $e->getMessage(); and die();
}catch(\Exception $e){
    Connector::handleException($e); //just print $e->getMessage(); and die();
}

if (isset($_SESSION['access_token']) && $_SESSION['access_token']) {

    $client->setAccessToken($_SESSION['access_token']);
    $connector = Connector::init($client);

    require_once "views/index.php";

} else {
    $redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . '/oauth2callback.php';
    header('Location: ' . filter_var($redirect_uri, FILTER_SANITIZE_URL));
}

場所をviews/index.php取得して印刷するだけです。

私は「アプリ」を実行しますphp -S localhost:8000

時々エラーが発生するため、ほとんどすべてが問題ありません。

cURL error 35: OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to mybusiness.googleapis.com:443 (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

cURL error 35: OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to oauth2.googleapis.com:443 (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

すべてが正常に戻るまで、サイトを数回更新する必要があります。数日前、すべてが順調でした。最初の更新後に機能し始める場合もあれば、5 分かかる場合もあります。

なんで?どうにか直せませんか?

4

1 に答える 1