Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/256.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从Foursquare API获取给定城市和类别中的POI_Php_Foursquare - Fatal编程技术网

Php 从Foursquare API获取给定城市和类别中的POI

Php 从Foursquare API获取给定城市和类别中的POI,php,foursquare,Php,Foursquare,我想使用Foursquare API获取给定城市的场地。API有两个端点可以帮助我解决问题: 场馆/探索和场馆/搜索 现在的问题是,它们都缺少另一个端点所需要的特性。例如,我不能使用explore端点,因为我无法将类别ID传递给foursquare api,以便仅在给定类别中进行搜索 所以现在我已经有了来使用搜索端点,但是搜索端点还有另一个问题。intent参数。intent参数接受签入、浏览、全局、匹配 checkin查找用户将在当前时刻签入的POI。问题:我想在晚上运行cronjob,所以它

我想使用Foursquare API获取给定城市的场地。API有两个端点可以帮助我解决问题:
场馆/探索
场馆/搜索

现在的问题是,它们都缺少另一个端点所需要的特性。例如,我不能使用explore端点,因为我无法将类别ID传递给foursquare api,以便仅在给定类别中进行搜索

所以现在我已经有了来使用搜索端点,但是搜索端点还有另一个问题。intent参数。intent参数接受签入、浏览、全局、匹配

checkin
查找用户将在当前时刻签入的POI。问题:我想在晚上运行cronjob,所以它永远找不到博物馆,因为它可能在晚上关闭

browse
有一个问题,我必须传递半径参数。但由于不是每个城市都有相同的半径,我也会在我的搜索请求中找到其他城市的搜索结果。例如,如果我在科隆搜索POI,半径为30公里,我也会在杜塞尔多夫找到POI。但在其他一些城市,30公里的半径是个不错的选择,我只能在给定的城市中找到泊松点。我不能确定我的半径是否正确

global
独立于位置进行搜索,因此它也是无用的

match
不包含类别,因此它也没用

好的,让我们一起总结一下,我需要做什么

我需要找到的地点是在某个城市,并有特定的类别只有! 我在这里创建了这个url,用于从foursquare查询数据

现在从东京返回场馆:(我将其限制为3个,因此我们这里没有太多数据显示)

这现在有多个问题:

  • 城市名称使用国家语言(非英语)
  • 用于此搜索的foursquare API会返回一个城市的涉谷(作为一个例子),该城市是一个特殊的选区,而不是一个城市和一个州的东京。然而,在德国,城市就是城市,就像科隆,州就是州,就像北莱茵-威斯特伐利亚
  • 这导致了一个问题,即我无法轻松比较各个城市,以查看POI是否位于请求的城市。不过,我可以检查城市或州是否匹配,但每个国家的情况可能不同,因此我认为这是一个问题

    那么,对于不受时间、地点等影响的特定类别,仅获取给定城市中的城市,并从非请求城市中过滤出POI的最佳方法是什么

    {
       "meta":{
          "code":200
       },
       "response":{
          "venues":[
             {
                "id":"4b7af3d1f964a520e3472fe3",
                "name":"伊勢丹 新宿店 (Isetan Shinjuku)",
                "contact":{
                   "phone":"+81333521111",
                   "formattedPhone":"+81 3-3352-1111"
                },
                "location":{
                   "address":"新宿3-14-1",
                   "lat":35.69167888630371,
                   "lng":139.70466434955597,
                   "postalCode":"160-0022",
                   "cc":"JP",
                   "city":"新宿区",
                   "state":"東京都",
                   "country":"Japan",
                   "formattedAddress":[
                      "新宿3-14-1",
                      "新宿区, Tōkyō",
                      "160-0022",
                      "Japan"
                   ]
                },
                "categories":[
                   {
                      "id":"4bf58dd8d48988d1f6941735",
                      "name":"Kaufhaus",
                      "pluralName":"Kaufhäuser",
                      "shortName":"Kaufhaus",
                      "icon":{
                         "prefix":"https:\/\/ss3.4sqi.net\/img\/categories_v2\/shops\/departmentstore_",
                         "suffix":".png"
                      },
                      "primary":true
                   }
                ],
                "verified":false,
                "stats":{
                   "checkinsCount":38525,
                   "usersCount":14542,
                   "tipCount":104
                },
                "url":"http:\/\/www.isetan.co.jp\/icm2\/jsp\/store\/shinjuku\/",
                "specials":{
                   "count":0,
                   "items":[
    
                   ]
                },
                "hereNow":{
                   "count":0,
                   "summary":"Keiner hier",
                   "groups":[
    
                   ]
                },
                "referralId":"v-1416841962"
             },
             {
                "id":"4b6a8c00f964a5204fd82be3",
                "name":"東急 田園都市線 渋谷駅",
                "contact":{
                   "phone":"+81354585143",
                   "formattedPhone":"+81 3-5458-5143"
                },
                "location":{
                   "address":"道玄坂2-1-1",
                   "lat":35.65325468817092,
                   "lng":139.69734217064342,
                   "cc":"JP",
                   "city":"渋谷区",
                   "state":"東京都",
                   "country":"Japan",
                   "formattedAddress":[
                      "道玄坂2-1-1",
                      "渋谷区, Tōkyō",
                      "Japan"
                   ]
                },
                "categories":[
                   {
                      "id":"4bf58dd8d48988d129951735",
                      "name":"Bahnhof",
                      "pluralName":"Bahnhöfe",
                      "shortName":"Bahnhof",
                      "icon":{
                         "prefix":"https:\/\/ss3.4sqi.net\/img\/categories_v2\/travel\/trainstation_",
                         "suffix":".png"
                      },
                      "primary":true
                   }
                ],
                "verified":false,
                "stats":{
                   "checkinsCount":51145,
                   "usersCount":6686,
                   "tipCount":21
                },
                "specials":{
                   "count":0,
                   "items":[
    
                   ]
                },
                "hereNow":{
                   "count":0,
                   "summary":"Keiner hier",
                   "groups":[
    
                   ]
                },
                "referralId":"v-1416841962"
             },
             {
                "id":"543365cd498e6a226ce59c11",
                "name":"la kagu ラカグ",
                "contact":{
                   "phone":"+81352276977",
                   "formattedPhone":"+81 3-5227-6977",
                   "twitter":"la_kagu",
                   "facebook":"470802349690219",
                   "facebookUsername":"lakagu.kagurazaka",
                   "facebookName":"ラカグ la kagu"
                },
                "location":{
                   "address":"矢来町67",
                   "lat":35.70377775661292,
                   "lng":139.73318235755823,
                   "postalCode":"162-0805",
                   "cc":"JP",
                   "city":"Tokyo",
                   "state":"東京都",
                   "country":"Japan",
                   "formattedAddress":[
                      "矢来町67",
                      "新宿区, Tōkyō",
                      "162-0805",
                      "Japan"
                   ]
                },
                "categories":[
                   {
                      "id":"4bf58dd8d48988d1f8941735",
                      "name":"Möbel- \/ Einrichtungsgeschäft",
                      "pluralName":"Möbel- \/ Einrichtungsgeschäfte",
                      "shortName":"Möbel \/ Einrichtung",
                      "icon":{
                         "prefix":"https:\/\/ss3.4sqi.net\/img\/categories_v2\/shops\/furniture_",
                         "suffix":".png"
                      },
                      "primary":true
                   }
                ],
                "verified":false,
                "stats":{
                   "checkinsCount":468,
                   "usersCount":429,
                   "tipCount":5
                },
                "url":"http:\/\/www.lakagu.com",
                "specials":{
                   "count":0,
                   "items":[
    
                   ]
                },
                "hereNow":{
                   "count":0,
                   "summary":"Keiner hier",
                   "groups":[
    
                   ]
                },
                "referralId":"v-1416841962"
             }
          ],
          "geocode":{
             "what":"",
             "where":"35.6894875,139.69170639999993",
             "feature":{
                "cc":"JP"
             },
             "parents":[
    
             ]
          }
       }
    }