google-cloud-php: BigQuery - Couldn't resolve host 'www.googleapis.com'
I created a PHP script to retrieve some datas from my Google Cloud Platform account. Below is how I did :
<?php
require __DIR__ . '/vendor/autoload.php';
use Google\Cloud\BigQuery\BigQueryClient;
putenv('GOOGLE_APPLICATION_CREDENTIALS=key.json');
$projectId = 'xxxxx';
$datasetId = 'xxxxxx';
$table = 'xxxxx';
$bigQuery = new BigQueryClient([
'projectId' => $projectId
]);
// etc...
Everything works fine on my local computer (WAMP) but when I migrate my script to my company production environment, there is a problem :
Fatal error: Uncaught exception ‘Google\Cloud\Core\Exception\ServiceException’ with message 'cURL error 6: Couldn’t resolve host ‘www.googleapis.com’
In fact I was excepting this message because every time I use Curl, I need to set our company proxy info :
<?php
curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, true);
curl_setopt($curl, CURLOPT_PROXY, 'xxx.xxx.xxx.xxx');
By the way, i’m 100% sure that googleapis.com is white-listed by our proxies… but how to do it with the BigQueryClient ? I searched in the official documentation, no way to find how to use a proxy.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 16 (9 by maintainers)
@paolo75015 I am going to close this out now, in favor of https://github.com/GoogleCloudPlatform/google-cloud-php/issues/1268. Thank you again for the report 😃.