简体   繁体   English

PHP:FedEx Web服务

[英]PHP: FedEx Web Services

I'm trying to track a number that uses FedEx, but I can't get the series of events shown as in the website. 我正在尝试跟踪使用FedEx的号码,但无法获得网站中显示的一系列事件。 I'm using the Track Web Services and using a Test Key. 我正在使用Track Web Services和测试键。 I'm currently using 我目前正在使用

$response->CompletedTrackDetails->TrackDetails->Events

which only gives me the first step (out of a total of 9). 这只是第一步(总共9个步骤)。 Please, what am I doing wrong. 拜托,我在做什么错。

I'm not sure how you're parsing the XML response, but you need to loop thru TrackReply->TrackDetails->Events 我不确定您如何解析XML响应,但是您需要通过TrackReply-> TrackDetails-> Events进行循环

Something like this... 像这样

$ScanCount = substr_count ($Response, '<Events>') ;
$xmlresult = xml2array($Response);

if ( $ScanCount > 1 ) {

for ( $i=0 ; $i < $ScanCount ; $i++) {
    $status=$xmlresult['TrackReply']['TrackDetails']['Events'][$i]['EventDescription']['value'];
// addl parsing...
}
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM