簡體   English   中英

如何使用谷歌業務獲取業務詳細信息

[英]How to get the business details using google business

我想獲取在谷歌業務中添加的業務詳細信息。 例如,一個人搜索“新德里的電腦商店”。 然后我想顯示新德里計算機商店的所有詳細信息,在不顯示地圖的情況下,在谷歌業務(或地圖)中列出。 如何在網絡中實現(php 或 js 或網絡中的任何編程語言)。

我建議從 Google Places API 開始。 這本質上是 Maps API 的一個子集。 不要求實際渲染地圖本身。

https://developers.google.com/places/

https://developers.google.com/maps/documentation/javascript/places#place_details

更新:

這是一個 CodePen 示例,顯示了一個使用 jQuery 的非常快速和骯臟的基本示例。

var placesAPIAccessKey = '<your key here>';  

var placesSearchAPIEndpoint = 'http://crossorigin.me/https://maps.googleapis.com/maps/api/place/nearbysearch/json';
var placesLookupAPIEndpoint = 'http://crossorigin.me/https://maps.googleapis.com/maps/api/place/details/json';

var placesSearchParams = {
  key: placesAPIAccessKey,
  location: '28.5219145,77.2189402', // New Dheli, India
  radius: 5000, // 5km search radius from center point
  type: 'electronics_store',
  keywords: 'computer shop store repair service laptop notebook chromebook hp acer asus apple dell'
};

function getThePlaces() {
  $.get(placesSearchAPIEndpoint,placesSearchParams,function(data){
    $.each(data.results, function(index,content) {
      $.get(placesLookupAPIEndpoint,{
        key:placesAPIAccessKey,
        placeid:content.place_id
      }, function(data) {
        $('body').append(
          '<div>'+ 
          data.result.name + '<br>' +
          ' Address: ' + data.result.formatted_address + '<br>' +
          ' Phone: ' + data.result.formatted_phone_number +
          '</div>');
      });
    });
  });
};

getThePlaces();

鏈接到實時 CodePen: http ://codepen.io/pixelchemist/pen/RGjYEQ * 請注意,您需要提供自己的場所 API 密鑰才能使其工作 *

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM