Search in google maps api returns different values with curl or guzzle

1

I do the search in google maps api with curl or guzzle using php and it returns me a different value than using postman or the browser

ex:

$client = new Client();
    $res = $client->request('GET', $url,[
        'query' => [
            'type' => 'gas_station',
            'query' => 'Uberlandia,MG',
            'key' => 'MYKEY',
        ],
    ]);

This returns me

{"html_attributions":[],"results":[],"status":"ZERO_RESULTS"}

but in the browser or in postman I get values through the url

https://maps.googleapis.com/maps/api/place/textsearch/json?type=gas_station&query=Uberlandia%2CMG&key=MYKEY

Not just this search, several return this error

$url = "https://maps.googleapis.com/maps/api/place/textsearch/json";
$client = new Client();
$res    = $client->request('GET', $url, [
  'headers' => [
    'User-Agent'    => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) 
     AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 
  Safari/537.36',
      'Accept'        => 'application/json',
    'Content-Type' => 'application/json',
    'cache-control' => 'no-cache',
],
'query' => [
    'type' => 'gas_station',
    'keyword' => 'posto,combustiveis',
    'query' => 'lago sul - Shi Sul Qi 05 Área Militar Vi Comar, S/n Parte - Lago Sul, Brasília - DF, Brasil',
    'key' => 'MYKEY'
],
]);

direct search of this generates this url

  

link

I already thought it was the urlencode but the search for this value in the curl is the same as I play in postman or chrome but always by curl or guzzle returns zero results

    
asked by anonymous 19.12.2018 / 20:21

0 answers