Код: Выделить всё
$client = new Google_Client();
$client->setApplicationName("Google Sheets API");
$client->setScopes([Google_Service_Sheets::SPREADSHEETS]);
$client->setAccessType("offline");
$path = "credentials.json";
$client->setAuthConfig($path);
$service = new Google_Service_Sheets($client);
$spreadsheetId = '...';
$newrow = ["a", "b", "c"];
$rows = [$newrow];
$valueRange = new Google_Service_Sheets_ValueRange();
$valueRange->setValues($rows);
$range = "Blad1";
$options = ["valueInputOption" => "USER_ENTERED"];
$service->spreadsheets_values->append($spreadsheetId, $range, $valueRange, $options);
Код: Выделить всё
Fatal error: Uncaught GuzzleHttp\Exception\ConnectException: cURL error 6: Could not resolve host: oauth2.googleapis.com (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://oauth2.googleapis.com/token
Я попробовал удалить вставленную вручную строку и с тех пор все снова работает нормально...
Подробнее здесь: https://stackoverflow.com/questions/787 ... google-she