我有一个脚本提供了一些IP地址的信息。如何从文本中提取某些内容?
我想从文本中提取国家。
在下面的文本国行是"Country: US"
我想显示:US
只
的文字是:
[Querying whois.arin.net]
[whois.arin.net]
#
# Query terms are ambiguous. The query is assumed to be:
# "n 173.194.74.100"
#
# Use "?" to get help.
#
#
# The following results may also be obtained via:
# http://whois.arin.net/rest/nets;q=173.194.74.100?showDetails=true&showARIN=false&ext=netref2
#
NetRange: 173.194.0.0 - 173.194.255.255
CIDR: 173.194.0.0/16
OriginAS: AS15169
NetName: GOOGLE
NetHandle: NET-173-194-0-0-1
Parent: NET-173-0-0-0-0
NetType: Direct Allocation
RegDate: 2009-08-17
Updated: 2012-02-24
Ref: http://whois.arin.net/rest/net/NET-173-194-0-0-1
OrgName: Google Inc.
OrgId: GOGL
Address: 1600 Amphitheatre Parkway
City: Mountain View
StateProv: CA
PostalCode: 94043
Country: US
RegDate: 2000-03-30
Updated: 2011-09-24
Ref: http://whois.arin.net/rest/org/GOGL
OrgTechHandle: ZG39-ARIN
OrgTechName: Google Inc
OrgTechPhone: +1-650-253-0000
OrgTechEmail: [email protected]
OrgTechRef: http://whois.arin.net/rest/poc/ZG39-ARIN
OrgAbuseHandle: ZG39-ARIN
OrgAbuseName: Google Inc
OrgAbusePhone: +1-650-253-0000
OrgAbuseEmail: [email protected]
OrgAbuseRef: http://whois.arin.net/rest/poc/ZG39-ARIN
#
# ARIN WHOIS data and services are subject to the Terms of Use
# available at: https://www.arin.net/whois_tou.html
#
我试图使用分离器阵列字符串分割“:”,然后使用的foreach - >然后strpos – semsem 2012-04-28 12:57:20
我想用得到的IP地址的国家exec('whois $ ip'),而不是从提供IP地址的网站获取它的IP地址 – semsem 2012-04-28 12:58:35
分割为“\ n”字符,然后foreach - >拆分“:” – 2012-04-28 12:59:29