数据录入软件ipdata

tech2022-08-06  138

数据录入软件ipdata

This article was created in partnership with ipdata. Thank you for supporting the partners who make SitePoint possible.

本文是与ipdata合作创建的。 感谢您支持使SitePoint成为可能的合作伙伴。

Modern websites are becoming more and more effective at customizing content based on their visitors’ location. They can redirect users to a page in their own language, display prices in the local currency, pre-fill webforms with location information, and show the current time and date for the correct timezone.

现代网站在根据访问者的位置定制内容方面变得越来越有效。 他们可以将用户重定向到使用其自己的语言的页面,以当地货币显示价格,使用位置信息预先填写网络表单,并显示正确时区的当前时间和日期。

ipdata is a low-latency API that provides website owners with a wide variety of information about their visitors based on IP address (IPv4 and IPv6). Think of it as an IP geolocation and threat intelligence API.

ipdata是一种低延迟API,可根据IP地址(IPv4和IPv6)为网站所有者提供有关其访问者的各种信息。 将其视为IP地理位置和威胁情报API。

By using a visitor’s IP address you can learn their continent, country, region, city, latitude and longitude, organization or ISP, and timezone. The API also detects Proxy and Tor users, as well as known spammers and bad bots. Blocking these risks will protect your website, and reduce the need for security strategies like CAPTCHA.

通过使用访客的IP地址,您可以了解其大陆,国家,地区,城市,经纬度,组织或ISP以及时区。 该API还可以检测Proxy和Tor用户,以及已知的垃圾邮件发送者和不良机器人。 阻止这些风险将保护您的网站,并减少对诸如CAPTCHA之类的安全策略的需求。

Let’s look specifically at some ways ipdata can help, and how to implement them on your own website.

让我们具体看一下ipdata可以提供帮助的一些方式,以及如何在自己的网站上实现它们。

重定向访问者并本地化内容 (Redirect Visitors and Localize Content)

When you visit the ipdata website you’ll immediately see what the service is capable of. Everything that can be learned from your own IP address is displayed.

当您访问ipdata网站时,您将立即看到该服务的功能。 将显示从您自己的IP地址中学到的所有内容。

That data includes:

该数据包括:

Whether you’re in the EU,

不管你在欧盟 Your city,

您的城市, State or region (and region code),

州或地区(和地区代码), Country (and country code),

国家(和国家代码), Continent (and continent code),

大陆(和洲代码), Latitude and longitude,

纬度和经度, Postal or zip code,

邮政编码 Country calling code,

国家/地区电话代码, Your country’s flag emoji,

您国家的国旗表情符号, Your service provider’s ASN and carrier information,

您的服务提供商的ASN和运营商信息, Languages,

语言, Currency (name, code, symbol, plural),

货币(名称,代码,符号,复数), Time zone (name and abbreviation, offset, daylight savings time, current time),

时区(名称和缩写,偏移量,夏令时,当前时间), Threat information (Tor, Proxy, anonymous, known attacker, known abuser, threat, bogon).

威胁信息(Tor,代理,匿名,已知攻击者,已知滥用者,威胁,威胁)。

You can call ipdata’s API on each page request to geolocate your visitors and localize their content. Here’s a handful of ideas of what you can achieve:

您可以在每个页面请求上调用ipdata的API,以对访问者进行地理定位并对其内容进行本地化。 以下是您可以实现的一些想法:

Restrict or block access to your content to specific countries or continents,

限制或阻止您访问特定国家或地区的内容, Redirect users to country-specific (or language-specific) sites or pages,

将用户重定向到特定国家(或特定语言)的网站或页面, Pre-fill your webforms with their location data,

使用其位置数据预先填写您的网络表单, Show your visitors their local time and weather,

向您的访客显示当地时间和天气, Display events that are near your visitors, or available flights in their area,

显示您的访客附近的活动或他们所在地区的可用航班, Serve targeted ads based on location,

根据位置投放有针对性的广告, Enforce GDPR compliance,

加强GDPR合规性, Automatically convert prices on your e-commerce store to their local currency, using the correct currency symbol,

使用正确的货币符号自动将电子商务商店中的价格转换为当地货币, More accurately analyze where your traffic is coming from.

更准确地分析您的流量来自何处。

You can get a client’s IP address using JavaScript, but it’s a bit of work. Instead, use ipdata’s API. It’s super-fast and reliable across all browsers. Here’s the code:

您可以使用JavaScript来获取客户端的IP地址,但这需要一些工作。 而是使用ipdata的API。 它在所有浏览器中都是超快速且可靠的。 这是代码:

$.get("https://api.ipdata.co?api-key=test", function(response) { console.log(response.ip); }, "jsonp");

Once you have a visitor’s API address, ipdata’s documentation shows you how to get their location in 26 different languages. You’ll also find detailed tutorials on how to code for a variety of use cases. Here are a few examples.

有了访问者的API地址后,ipdata的文档将向您展示如何以26种不同的语言获取其位置。 您还将找到有关如何为各种用例进行编码的详细教程。 这里有一些例子。

To block (or allow) users by country, look up the ISO 3166 ALPHA-2 Country Codes for the ones you want to blacklist or whitelist. Then follow this sample code to learn how to blacklist or whitelist them.

要按国家阻止(或允许)用户 ,请在ISO 3166 ALPHA-2国家/地区代码中查找要列入黑名单或白名单的用户。 然后按照此示例代码学习如何将它们列入黑名单或白名单。

// List of countries we want to block // To see this in action add your country code to the array var blacklist = ['US', 'CA', 'UK', 'IN'] // Getting the country code from the user's IP $.get("https://api.ipdata.co?api-key=test", function (response) { // Checking if the user's country code is in the blacklist // You could inverse the logic here to use a whitelist instead if (blacklist.includes(response.country_code)) { alert('This content is not available at your location.'); } else { alert("You're allowed to see this!") } }, "jsonp");

Redirecting users by country is useful if you have country-specific online stores, or if you have a separate page with content in their language or with country-specific contact details.

如果您拥有特定国家/地区的在线商店,或者您拥有一个单独的页面,其中包含其语言或特定国家/地区的联系方式, 则按国家/地区重定向用户很有用。

Here’s an example of how to redirect your visitors located in Germany and Australia. They will be redirected from https://uk.store.ipdata.co to https://de.store.ipdata.co and https://au.store.ipdata.co.

这是有关如何重定向位于德国和澳大利亚的访问者的示例。 它们将从https://uk.store.ipdata.co重定向到https://de.store.ipdata.co和https://au.store.ipdata.co。

// Getting the country code from the user's IP $.get("https://api.ipdata.co?api-key=test", function (response) { if (response.country_code == 'UK') { window.location.href = "https://uk.store.ipdata.co"; } else if (response.country_code == 'DE') { window.location.href = "https://de.store.ipdata.co"; } else if (response.country_code == 'AU') { window.location.href = "https://au.store.ipdata.co"; } }, "jsonp");

You can also personalize the content of your site depending on the user’s location. Here’s an example that displays a special offer to UK visitors only:

您还可以根据用户的位置来个性化网站的内容 。 这是一个仅向英国游客显示特别优惠的示例:

// Getting the country name from the user's IP $.get("https://api.ipdata.co?api-key=test", function (response) { if (response.country_code == 'UK') { alert("Special offer for all our users from " +response.country_name+ "!"); } }, "jsonp");

Instead of targeting a whole country, you can drill down to region, city or postal code (zip code). Alternatively, you could target a time zone or specific currency.

您可以深入到区域,城市或邮政编码(邮政编码),而不是针对整个国家/地区。 或者,您可以定位时区或特定货币。

You can further personalize your content by displaying the user’s local time (adjusted for DST) and local currency symbol. To request time zone data for IP address “3.3.3.3”:

您可以通过显示用户的本地时间(为DST调整)和本地货币符号来进一步个性化您的内容。 要请求IP地址“ 3.3.3.3”的时区数据:

$ curl https://api.ipdata.co/3.3.3.3/time_zone?api-key=test

You’ll receive this response, which includes the name and abbreviation of the time zone, its UTC offset, whether it is currently DST, and the local time:

您将收到此响应,其中包括时区的名称和缩写,其UTC偏移量,当前是否为DST以及本地时间:

{ "name": "America/Los_Angeles", "abbr": "PDT", "offset": "-0700", "is_dst": true, "current_time": "2019-03-27T01:13:48.930025-07:00" }

Currency detection is similar. Here’s an example for the IP address “203.100.0.51”:

货币检测与此类似。 这是IP地址“ 203.100.0.51”的示例:

curl https://api.ipdata.co/203.100.0.51/currency?api-key=test

And the response:

以及响应:

{ "name": "Australian Dollar", "code": "AUD", "symbol": "AU$", "native": "$", "plural": "Australian dollars" }

保护您的网站免受威胁 (Protect Your Website from Threats)

You can also use ipdata to identify potential threats against your website. They maintain a database of over 600 million malicious IP addresses, open proxies, Tor nodes, spammers, botnets, and attackers. These are aggregated only from high-quality, authoritative sources. You can use this information in a variety of ways:

您还可以使用ipdata来识别对您的网站的潜在威胁。 他们维护着一个包含6亿多个恶意IP地址,开放代理,Tor节点,垃圾邮件发送者,僵尸网络和攻击者的数据库。 这些仅从高质量,权威的来源中汇总而来。 您可以通过多种方式使用此信息:

Protect your comments by blocking known spammers and bad bots, alleviating the need for CAPTCHA,

通过阻止已知的垃圾邮件发送者和不良机器人来保护您的评论,减轻对验证码的需求, Detect frauds by determining if their credit card is from a country different to where they are located,

通过确定其信用卡是否来自与其所在国家/地区不同的国家来检测欺诈行为, Block anonymous traffic to eliminate the risks that come from such networks,

阻止匿名流量以消除此类网络带来的风险, Block high-risk countries, such as the countries where most of your malware and attacks originate,

封锁高风险国家/地区,例如大多数恶意软件和攻击起源的国家/地区, Prevent “free trial abuse” by detecting Proxy and Tor users.

通过检测代理和Tor用户来防止“免费试用滥用”。

Here’s how to access the threat data for the IP address “103.76.180.54”:

以下是访问IP地址“ 103.76.180.54”的威胁数据的方法:

curl https://api.ipdata.co/103.76.180.54/threat?api-key=test

The request generates the following response:

该请求生成以下响应:

{ "is_tor": true, "is_proxy": false, "is_anonymous": true, "is_known_attacker": false, "is_known_abuser": false, "is_threat": false, "is_bogon": false }

The visitor is using a Tor network. is_anonymous is true if the visitor is either a Tor or Proxy user. You can use ipdata to stop anonymous users creating an account. Here’s some sample code from the official documentation:

访客正在使用Tor网络。 如果访问者是Tor用户或代理用户,则is_anonymous为true。 您可以使用ipdata 阻止匿名用户创建帐户 。 以下是官方文档中的一些示例代码:

// Getting the anonymity status from the user's IP $.get("https://api.ipdata.co?api-key=test", function (response) { if (response.threat.is_anonymous) { alert("You are not allowed to create an account."); } }, "jsonp");

You can get more specific, for example, by blocking Proxy users but letting Tor users through:

您可以通过阻止代理用户但让Tor用户通过以下方式来获得更具体的信息:

// Getting the anonymity status from the user's IP $.get("https://api.ipdata.co?api-key=test", function (response) { if (response.threat.is_proxy) { alert("You are not allowed to create an account."); } }, "jsonp");

Some users are repeat offenders, having been repeatedly reported by admins of other websites for spam or malicious activity. You can stop them from creating an account by blocking them if one of these fields are true:

一些用户是屡犯,是其他网站的管理员屡次报告其垃圾邮件或恶意活动。 如果这些字段之一为真,则可以通过阻止它们来阻止他们创建帐户:

is_known_abuser: IP addresses that have been reported to be sources of spam,

is_known_abuser :已报告为垃圾邮件源的IP地址,

is_known_attacker: IPs that have been reported to be the source of malicious activity.

is_known_attacker :据报告是恶意活动来源的IP。

为什么选择ipdata? (Why Choose ipdata?)

ipdata compares very favorably with other IP Geolocation APIs. It is written in Python 3 with an average execution time of 2.9 ms. It’s fast and reliable enough to keep a long list of clients happy, including Comcast, Redhat, Cooperpress, Sphero, AMD, and NASA.

ipdata与其他IP Geolocation API相比非常有利。 它是用Python 3编写的,平均执行时间为2.9 ms。 它的速度和可靠性足以使一长串客户满意,其中包括Comcast,Redhat,Cooperpress,Sphero,AMD和NASA。

ipdata is highly scalable, with low latency globally. The API serves millions of requests every day at an average speed of just ~65ms, and runs in eleven data centers around the world:

ipdata具有高度可扩展性,并且全局延迟低。 该API每天平均以约65毫秒的速度处理数百万个请求,并在全球11个数据中心中运行:

4 in the US,

美国有4个, 1 in Canada,

1在加拿大, 2 in Europe (London and Frankfurt),

欧洲的2个(伦敦和法兰克福), 1 in India (Mumbai),

印度(孟买)的1名, 1 in South America (Sao Paulo),

南美洲1(圣保罗), 1 in Europe (Seol), and

欧洲(首尔)为1,并且 1 in Australia (Sydney).

1在澳大利亚(悉尼)。

According to Jonathan Kosgei, the Founder of ipdata, execution time is kept low by not doing any database reads or writes in the application code. “A separate authorizer function handles getting usage data from DynamoDB and authorizing users based on whether they’re within their quota or not. And its results are cached.”

ipdata创始人Jonathan Kosgei认为,通过不对应用程序代码进行任何数据库读取或写入操作,可以将执行时间保持在较低水平。 “一个单独的授权器功能可处理从DynamoDB获取使用情况数据并根据用户是否在其配额内进行授权。 其结果将被缓存。”

开始使用ipdata定位访问者 (Start Geolocating Your Visitors with ipdata)

By now I’m sure you’ve thought of a dozen ways you can use ipdata to enhance and protect your website, or those of your clients. Sign up for free and start testing it!

到目前为止,我确定您已经想到了使用ipdata增强和保护您的网站或客户网站的十二种方法。 免费注册并开始测试!

You can read more about ipdata’s infrastructure in these articles:

您可以在以下文章中阅读有关ipdata基础架构的更多信息:

How ipdata uses AWS to serve a global, highly-scalable IP geolocation API (AWS Startups Blog)—goes into more detail with a focus on AWS,

ipdata如何使用AWS来提供全球性的,高度可扩展的IP地理位置API (AWS Startups博客)-更加详细地介绍了AWS,

How Ipdata Serves 25M API Calls From 10 Infinitely Scalable Global Endpoints For $150 A Month (High Scalability)—details how he responded to a failure on Black Friday by choosing a new tech stack.

Ipdata如何以每月150美元 ( 每月可扩展性)的价格为10个无限扩展的全球端点提供2500万个API调用 (高可扩展性),详细说明了他如何通过选择新的技术堆栈来应对黑色星期五的失败。

See a comparison of ipdata to all the top IP Geolocation APIs.

查看ipdata与所有顶级IP Geolocation API的比较 。

翻译自: https://www.sitepoint.com/use-ipdatas-geolocation-data-to-protect-customize-your-site/

数据录入软件ipdata

相关资源:IPdata源码
最新回复(0)