[output_none] [var: 'licensecode'=(form_param: 'licensecode')] [inline: -database='nrgsoft', -table='daily_webservice', -keyfield='daily_id', -operator='eq', 'licensecode'=($licensecode), -operator='eq', 'date'=(server_date: -Extended), -operator='eq', 'client_ip'=(client_ip), 'service'='fedex_track', -search] [if: (found_count) >= 1] [var: 'counter' = (math_add: field: 'counter','1')] [inline: -database='nrgsoft', -table='daily_webservice', -keyfield='daily_id', -keyvalue=(keyfield_value), 'counter'=($counter), 'last'=(Date_Format: (Date), -Format='%T'), -update] [/inline] [else] [inline: -database='nrgsoft', -table='daily_webservice', 'licensecode'=($licensecode), 'date'=(server_date: -Extended), 'counter'='1', 'client_ip'=(client_ip), 'client_type'=(client_type), 'result'='html', 'response_filepath'=(response_filepath), 'first'=(Date_Format: (Date), -Format='%T'), 'service'='fedex_track', -add] [var: 'counter' = '1'] [/inline] [/if] [/inline] [/output_none] [if: ($licensecode) == '' && ($counter) > 100] Error - Unlicensed FedEx tracking requests are limited to 100 per day by IP number.
Please contact NRG Software for pricing information and other service options.
[abort] [/if] Live Fedex Tracking Results for tracking #'+$trackNumb+' '; // only get results if a tracking number is supplied. if: $trackNumb !=''; // build query for Fedex's Server var:'query'='0,"403"1534,"Y"1537,"' + $trackNumb + '"99,""'; // Get Tracking Data from Fedex // Note: It is recommended that you acquire a meter number from Fedex // although i'm not using one here and it still works.. so up to you. // Using the new PostParams tag to get results.. thanks BlueWorld! var:'result'= (Include_URL: 'https://gateway.fedex.com/GatewayDC', -POSTParams=$query); // Parse Results // Fedex returns a very strange pattern, so we'll make it work protect; $result = (String_Replace: $result, -Find=',"', -Replace='|||'); $result = (String_Replace: $result, -Find='"', -Replace='+++'); /protect; // build array of results var:'FDXArray'=(array); protect; var:'FDXArray'= $result->(Split:'+++'); /protect; // put the results array into a mapped array var:'FDXmap'=(map); loop: $FDXArray->(Size); var:'tempString'=$FDXArray->(get: (loopcount)); var:'tempArray'=$tempString->(Split:'|||'); var:'tempCode'=$tempArray->(Get:'1'); if:$tempArray->(size) > '1'; var:'tempResult'=$tempArray->(get:'2'); else; var:'tempResult'=''; /if; $FDXmap->(Insert: (var:'tempCode')=(var:'tempResult')); /loop; // display any errors from Fedex if: $FDXMap->(find: '3') != ''; '

'; $FDXMap->(Find: '3'); '
'; else; // now all the results are in a mapped array called $FDXMap // see the Fedex Tagged Transaction Guide for code references // make easy to read variables for the main ones var:'weight'=$FDXmap->(find:'1401-1'), 'weightdesc'=$FDXmap->(find:'75-1'), 'city'=$FDXmap->(find:'15-1'), 'state'=$FDXmap->(find:'16-1'), 'zip'=$FDXmap->(find:'17-1'), 'country'=$FDXmap->(find:'50-1'), 'UCN'=$FDXmap->(find:'1537-1-1'), 'orderNumber'=$FDXmap->(find:'1537-1-2'), 'packageID'=$FDXmap->(find:'1537-1-3'), 'tempSDate'=$FDXmap->(find:'24-1'), 'tempDDate'=$FDXmap->(find:'1720-1'), 'tempDTime'=$FDXmap->(find:'1707-1'), 'tempEDate'=$FDXmap->(find:'1339-1'), 'tempETime'=$FDXmap->(find:'1340-1'), 'tempRDate'=$FDXmap->(find:'1716-1'), 'tempRTime'=$FDXmap->(find:'1717-1'), 'serviceType'=$FDXmap->(find:'1704-1'), 'items'=$FDXmap->(find:'116-1'), 'signedFor'=$FDXmap->(find:'1706-1'), 'serviceCode'=$FDXmap->(find:'3025-1'); // parse expected delivered date // this part is messy, but it works.. sorry // need to rewrite using date tags var: 'expectedDate'='', 'expectedTime'=''; if: $tempEDate !=''; var: 'ExpectedDate'= $tempEDate->(substring: 5,2) + '/' + $tempEDate->(substring: 7,2) + '/' + $tempEDate->(substring: 1,4); /if; if: $tempETime !=''; var: 'ExpectedTime'= $tempETime->(substring: 1,2) + ':' + $tempETime->(substring: 3,2) + ':' + $tempETime->(substring: 5,2); /if; var: 'reattemptDate'='', 'reattemptTime'=''; if: $tempRDate !=''; var: 'ReattemptDate'=$tempRDate->(substring: 5,2) + '/' + $tempRDate->(substring: 7,2) + '/' + $tempRDate->(substring: 1,4); /if; if: $tempRTime !=''; var: 'ReattemptTime'=$tempRTime->(substring: 1,2) + ':' + $tempRTime->(substring: 3,2) + ':' + $tempRTime->(substring: 5,2); /if; // parse delivered date var: 'deliveryDate'='', 'shipdate'='', 'deliveryTime'=''; if: $tempDDate !=''; var: 'DeliveryDate'= $tempDDate->(substring: 5,2) + '/' + $tempDDate->(substring: 7,2) + '/' + $tempDDate->(substring: 1,4); /if; if: $tempDTime !=''; var: 'DeliveryTime'= $tempDTime->(substring: 1,2) + ':' + $tempDTime->(substring: 3,2) + ':' + $tempDTime->(substring: 5,2); /if; if: $tempSDate !=''; var: 'ShipDate'= $tempSDate->(substring: 5,2) + '/' + $tempSDate->(substring: 7,2) + '/' + $tempSDate->(substring: 1,4); /if; // build a table of the info, modify as you wish // note: not all fields are always populated '
Package Weight:' + $weight + $weightDesc ' Ship Date:' + $ShipDate + '
Location:' + $city + ', ' + $state + ' ' + $zip + ' UCN:' + $UCN + ' Country:' + $country + '
Order #:' + $OrderNumber + ' Package ID:' + $PackageID + '
Delivered On:' + $DeliveryDate + ' ' + $DeliveryTime + '
Reattempt Date:' + $reattemptDate + ' ' + $reattemptTime + ' Expected Date:' + $expectedDate + ' ' + $expectedTime + '
Service Type:' + $serviceType + ' Signed For:' + $signedFor + '
Service Code:' + $serviceCode + ' Items:' + $items + '
'; // now build scan history into some pretty tables // 1715-1 contains the number of scan history lines var:'historyItems'=integer:($FDXmap->(find:'1715-1')); if: $historyitems > 0; ''; ''; loop: $historyitems; var: 'scanCode' = $FDXmap->(find: ('1171-1-'+(loopcount))); var: 'scanMsg' = $FDXmap->(find: ('1159-1-'+(loopcount))); var: 'scanCity' = $FDXmap->(find: ('1160-1-'+(loopcount))); var: 'scanState' = $FDXmap->(find: ('1161-1-'+(loopcount))); var: 'scanCountry' = $FDXmap->(find: ('1164-1-'+(loopcount))); var: 'scanDate' = $FDXmap->(find: ('1162-1-'+(loopcount))); var: 'scanTime' = $FDXmap->(find: ('1163-1-'+(loopcount))); var: 'scanComments'= $FDXmap->(find: ('1711-1-'+(loopcount))); // reformat date if: $scanDate !=''; var:'tempScanDate'= $scanDate; var: 'ScanDate'= $tempscanDate->(substring: 5,2) + '/' + $tempscanDate->(substring: 7,2) + '/' + $tempscanDate->(substring: 1,4); /if; // reformat time if: $scanTime !=''; var:'tempScanTime'= $scanTime; var: 'ScanTime'= $tempscanTime->(substring: 1,2) + ':' + $tempscanTime->(substring: 3,2) + ':' + $tempscanTime->(substring: 5,2); /if; ' '; ''; '\r'; /loop; '
Scan Date' +''; ' '+ 'Scan Time' +''; ' '+ 'Code' +''; ' '+ 'Message' +''; ' '+ 'City' +''; ' '+ 'State' +''; ' '+ 'Country' +''; ' '+ 'Comment' +'
'+ $scanDate +''; $scanTime +''; $scanCode +''; $scanMsg +''; $scanCity +''; $scanState +''; $scanCountry +''; $scanComments +'

Provided as a service by NRG Software, LLC.
Submit feedback'; //'' + $DeliveryDate + '' + $DeliveryTime + ''; /if; /if; /if; ?>