我研究了又研究,找不到答案。下面是我在调用 API 后得到的部分响应。
{
"api_version":"0.4",
"results":
{
"companies":[
{
"company":
{
"name":"BILL, HILLARY \u0026 CHELSEA CLINTON FOUNDATION",
"company_number":"EXTUID_4147727",
"jurisdiction_code":"us_dc",
"incorporation_date":"1997-10-23",
"dissolution_date":"2014-11-20",
"company_type":"Non-Profit Corporation",
"registry_url":"https://corp.dcra.dc.gov/BizEntity.aspx/ViewEntityData?entityId=4147727",
"branch":"F",
"branch_status":"branch of an out-of-jurisdiction company",
"inactive":true,
"current_status":"Revoked",
"created_at":"2015-12-04T13:32:35+00:00",
"updated_at":"2018-01-16T16:14:02+00:00",
"retrieved_at":"2016-03-14T00:40:43+00:00",
"opencorporates_url":"https://opencorporates.com/companies/us_dc/EXTUID_4147727",
"previous_names":[],
"source":
{
"publisher":"District of Columbia Department of Consumer and Regulatory Affairs",
"url":"https://corp.dcra.dc.gov/BizEntity.aspx/ViewEntityData?entityId=4147727",
"retrieved_at":"2016-03-14T00:40:43+00:00"},
"registered_address":
{
"street_address":"1200 PRESIDENT CLINTON AVENUE,",
"locality":"LITTLE ROCK",
"region":"Arkansas",
"postal_code":"72201",
"country":"United States"
},
}
},
下面是我的 PHP,我试图在其中检索、解析和显示 JSON 响应。
以下是我在尝试解析时收到的两个错误。
注意:未定义索引:公司在/opt/lampp/htdocs/OSINTTools.php 433行
警告:为第 433 行的 /opt/lampp/htdocs/OSINTTools.php 中的 foreach() 提供的参数无效
我想我收到这些错误是因为我没有正确访问这些值。有人能告诉我访问深度嵌套在这个 JSON 响应中的值的正确语法吗?提前致谢。
PS 我知道这个问题以前有人问过。我用漂亮的搜索工具找过和我类似的问题,都没有用。
翻阅古今
隔江千里