Php 如何从Easyship webhook解析此响应

Php 如何从Easyship webhook解析此响应,php,Php,我正在与Easyship合作,试图在订单状态发生变化时解析来自他们webhook的响应。首先,我甚至在接收数据时遇到问题,并尝试了以下方法: print_r($_POST, TRUE) print_r($_GET, TRUE) print_r($_REQUEST, TRUE) print_r(file_get_contents("php://input"), TRUE) @"event_type":"shipment.tracking.chec

我正在与Easyship合作,试图在订单状态发生变化时解析来自他们webhook的响应。首先,我甚至在接收数据时遇到问题,并尝试了以下方法:

print_r($_POST, TRUE)
print_r($_GET, TRUE)
print_r($_REQUEST, TRUE)
print_r(file_get_contents("php://input"), TRUE)
@"event_type":"shipment.tracking.checkpoints.created","resource_type":"shipment","resource_id":"ESHK25561976","tracking_status":{"easyship_shipment_id":"ESHK25561976","platform_order_number":"30","origin":"HK","destination":"HK","company_order_number":null,"status":"In Transit to Customer","tracking_number":"SF1042689716516","tracking_page_url":"https://www.trackmyshipment.co/shipment-tracking/ESHK25561976","checkpoints":[{"order_number":1,"handler":"SF Express Local","message":null,"location":null,"city":null,"country_name":"Hong Kong","country_iso3":"HKG","state":null,"postal_code":null,"checkpoint_time":"2020-10-16T17:47:10.802Z","primary_status":"Pending Pickup Confirmation",@"order_number":2,"handler":"SF Express Local","message":"Your package has been prepared and is awaiting pickup from SF Express Local","location":null,"city":null,"country_name":"Hong Kong","country_iso3":"HKG","state":null,"postal_code":null,"checkpoint_time":"2020-10-16T18:00:55.285Z","primary_status":"Awaiting Scan from Courier",@"order_number":101,"handler":"Sf Express","message":"【Hong Kong】 S.F. Express has picked up the shipment","location":"Hong Kong","city":"Hong Kong","country_name":null,"country_iso3":null,"state":null,"postal_code":null,"checkpoint_time":"2020-10-19T14:45:47.000Z","primary_status":"In Transit to Customer",@"order_number":102,"handler":"Sf Express","message":"【Hong Kong】 Shipment transiting to next station","location":"Hong Kong","city":"Hong Kong","country_name":null,"country_iso3":null,"state":null,"postal_code":null,"checkpoint_time":"2020-10-19T17:31:46.000Z","primary_status":"In Transit to Customer",@"order_number":103,"handler":"Sf Express","message":"【Hong Kong】 Shipment arrive at Hong Kong distribution center","location":"Hong Kong","city":"Hong Kong","country_name":null,"country_iso3":null,"state":null,"postal_code":null,"checkpoint_time":"2020-10-19T20:37:59.000Z","primary_status":"In Transit to Customer"]}}
只有最后一个接收任何数据。我收到的数据如下:

print_r($_POST, TRUE)
print_r($_GET, TRUE)
print_r($_REQUEST, TRUE)
print_r(file_get_contents("php://input"), TRUE)
@"event_type":"shipment.tracking.checkpoints.created","resource_type":"shipment","resource_id":"ESHK25561976","tracking_status":{"easyship_shipment_id":"ESHK25561976","platform_order_number":"30","origin":"HK","destination":"HK","company_order_number":null,"status":"In Transit to Customer","tracking_number":"SF1042689716516","tracking_page_url":"https://www.trackmyshipment.co/shipment-tracking/ESHK25561976","checkpoints":[{"order_number":1,"handler":"SF Express Local","message":null,"location":null,"city":null,"country_name":"Hong Kong","country_iso3":"HKG","state":null,"postal_code":null,"checkpoint_time":"2020-10-16T17:47:10.802Z","primary_status":"Pending Pickup Confirmation",@"order_number":2,"handler":"SF Express Local","message":"Your package has been prepared and is awaiting pickup from SF Express Local","location":null,"city":null,"country_name":"Hong Kong","country_iso3":"HKG","state":null,"postal_code":null,"checkpoint_time":"2020-10-16T18:00:55.285Z","primary_status":"Awaiting Scan from Courier",@"order_number":101,"handler":"Sf Express","message":"【Hong Kong】 S.F. Express has picked up the shipment","location":"Hong Kong","city":"Hong Kong","country_name":null,"country_iso3":null,"state":null,"postal_code":null,"checkpoint_time":"2020-10-19T14:45:47.000Z","primary_status":"In Transit to Customer",@"order_number":102,"handler":"Sf Express","message":"【Hong Kong】 Shipment transiting to next station","location":"Hong Kong","city":"Hong Kong","country_name":null,"country_iso3":null,"state":null,"postal_code":null,"checkpoint_time":"2020-10-19T17:31:46.000Z","primary_status":"In Transit to Customer",@"order_number":103,"handler":"Sf Express","message":"【Hong Kong】 Shipment arrive at Hong Kong distribution center","location":"Hong Kong","city":"Hong Kong","country_name":null,"country_iso3":null,"state":null,"postal_code":null,"checkpoint_time":"2020-10-19T20:37:59.000Z","primary_status":"In Transit to Customer"]}}
我不知道如何解析它来提取我需要的信息。我尝试过使用json_decode和parse_str的组合,但没有效果


有什么提示吗?

从外观上看,它应该是一个JSON字符串。您是否删除了使其成为无效JSON的字符串的任何部分?不,这是我得到的原始响应-从“@”开始,我会说重新检查webhook文档。现在大多数webhook都应该返回JSON。可能是出了什么问题。你对此有过决定吗?看起来easyship对他们的api服务器进行了窃听。Vlam认为easyship应该(而且通常是这样)只在webhook帖子中发送JSON内容是正确的。这也有可能是从代码库的其他地方注入的,或者是由web服务器注入的,等等。如果不能遵循代码并进行一些调试,就很难确定。几年来,我每天都在使用webhooks进行easyship集成,但从未遇到过这种情况。