地图上最新的Foursquare签到 [英] Lastest Foursquare check-in on map

查看:85
本文介绍了地图上最新的Foursquare签到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的网站上显示一张地图,该地图显示我上次的Foursquare签到.

I would like to display a map on my website that shows my last Foursquare check-in.

一篇很棒的博客文章解释了如何执行此操作

There is a great blog article explaining how to do this here.

但是,我担心我会达到Foursquare API速率限制( 每小时500个请求 ),因为地图将显示在网站的侧边栏中,因此每次有人查看该网站(或浏览到该网站上的其他页面)时,它都会对Foursquare API进行新的查询.如您所见,即使流量很小,也很可能会达到速率限制.

However, I am concerned that I will hit the Foursquare API rate limits (500 requests per hour) since the map will be displayed in the sidebar of the website, so everytime someone views the site (or browses to a different page on the site) it will do a new query to the Foursquare API. As you can see, even with a small amount of traffic it is likely the rate limit will be reached.

是否有解决此问题的方法,也许是通过某种缓存或通过Foursquare API以外的方法来检索我的最后签入信息?无论哪种方式,都需要在Google Map上显示签到信息.

Is there a way around this issue, perhaps by either doing some kind of caching or alternatively retrieving my last checkin information through an method other than the Foursquare API? Either way, the check-in needs to be displayed on a Google Map.

我想用PHP或Javascript/jQuery编写任何脚本.

I would like to write any scripting in either PHP or Javascript/jQuery.

推荐答案

您绝对不应该在每次页面加载时都发出API请求,这很容易超过小时配额,前提是您有足够的访问者来进行访问有问题.

You should definitely not make the API request each time the page is loaded, that could go over the hourly quota quite easily, assuming you have enough visitors to have that be a problem.

相反,您应该让一些后端定期轮询最新的签入并将其存储,然后让您的博客JS从后端请求您最新的签入位置.

Instead, you should have some backend periodically poll for your latest checkin and store it, then have your blog JS request your latest checkin location from your backend.

更好的是,您可以编写后端以接受来自Foursquare API的实时更新因此根本不需要轮询-每次您签入它都会获得POST,并且它可以存储该信息以将其显示在您的博客上.

Even better, you could write your backend to accept real-time updates from the Foursquare API so that it doesn't have to poll at all -- it will get a POST each time you check in, and it can store that information to display it on your blog.

这篇关于地图上最新的Foursquare签到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆