forked from JeremyDunn/php-fedex-api-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathasync-retrieve-job-results.php
35 lines (26 loc) · 1.33 KB
/
async-retrieve-job-results.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
//remember to copy example.credentials.php as credentials.php replace 'FEDEX_KEY', 'FEDEX_PASSWORD', 'FEDEX_ACCOUNT_NUMBER', and 'FEDEX_METER_NUMBER'
require_once 'credentials.php';
require_once 'bootstrap.php';
use FedEx\AsyncService\Request;
use FedEx\AsyncService\ComplexType;
use FedEx\AsyncService\SimpleType;
$retrieveJobResultsRequest = new ComplexType\RetrieveJobResultsRequest();
// Authentication & client details.
$retrieveJobResultsRequest->WebAuthenticationDetail->UserCredential->Key = FEDEX_KEY;
$retrieveJobResultsRequest->WebAuthenticationDetail->UserCredential->Password = FEDEX_PASSWORD;
$retrieveJobResultsRequest->ClientDetail->AccountNumber = FEDEX_ACCOUNT_NUMBER;
$retrieveJobResultsRequest->ClientDetail->MeterNumber = FEDEX_METER_NUMBER;
$retrieveJobResultsRequest->TransactionDetail->CustomerTransactionId = 'testing async service';
// Version.
$retrieveJobResultsRequest->Version->ServiceId = 'async';
$retrieveJobResultsRequest->Version->Major = 4;
$retrieveJobResultsRequest->Version->Intermediate = 0;
$retrieveJobResultsRequest->Version->Minor = 0;
$retrieveJobResultsRequest->JobId = 'your job id';
$request = new Request();
try {
$retrieveJobResultsReply = $request->getRetrieveJobResultsReply($retrieveJobResultsRequest);
} catch (\Exception $e) {
echo $request->getSoapClient()->__getLastResponse();
}