Enter your UPS tracking number below...UPS Logo

          
".$access_key."".$userid_pass."".$userid_pass."Example 11.0001Track".$activity."".$_POST['tracknum'].""; ////// /////////////////// begin the cURL engine ///////////////////// /////////////////////////////////////////////////////////////// //////////////////// What a powerful utility! ///////////////// /////////////////////////////////////////////////////////////// $ch = curl_init(); /// initialize a cURL session curl_setopt ($ch, CURLOPT_URL,$upsURL); /// set the post-to url (do not include the ?query+string here!) curl_setopt ($ch, CURLOPT_HEADER, 0); /// Header control curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);/// Use this to prevent PHP from verifying the host (later versions of PHP including 5) /// If the script you were using with cURL has stopped working. Likely adding the line above will solve it. curl_setopt($ch, CURLOPT_POST, 1); /// tell it to make a POST, not a GET curl_setopt($ch, CURLOPT_POSTFIELDS, $y); /// put the query string here starting with "?" curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); /// This allows the output to be set into a variable $xyz $upsResponse = curl_exec ($ch); /// execute the curl session and return the output to a variable $xyz curl_close ($ch); /// close the curl session //////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// /////////////////// end the cURL Engine ///////////////// //////////// begin xml parser Class function //////////// ///////////////////////////////////////////// /////// class function taken from http://www.hansanderson.com/php/xml/class.xml.php.txt class xml_container { function store($k,$v) { $this->{$k}[] = $v; } } class xml { var $current_tag=array(); var $xml_parser; var $Version = 1.0; var $tagtracker = array(); function startElement($parser, $name, $attrs) { array_push($this->current_tag, $name); $curtag = implode("_",$this->current_tag); if(isset($this->tagtracker["$curtag"])) { $this->tagtracker["$curtag"]++; } else { $this->tagtracker["$curtag"]=0; } if(count($attrs)>0) { $j = $this->tagtracker["$curtag"]; if(!$j) $j = 0; if(!is_object($GLOBALS[$this->identifier]["$curtag"][$j])) { $GLOBALS[$this->identifier]["$curtag"][$j] = new xml_container; } $GLOBALS[$this->identifier]["$curtag"][$j]->store("attributes",$attrs); } } // end function startElement /* when expat hits a closing tag, it fires up this function */ function endElement($parser, $name) { $curtag = implode("_",$this->current_tag); // piece together tag // before we pop it off, // so we can get the correct // cdata if(!$this->tagdata["$curtag"]) { $popped = array_pop($this->current_tag); // or else we screw up where we are return; // if we have no data for the tag } else { $TD = $this->tagdata["$curtag"]; unset($this->tagdata["$curtag"]); } $popped = array_pop($this->current_tag); // we want the tag name for // the tag above this, it // allows us to group the // tags together in a more // intuitive way. if(sizeof($this->current_tag) == 0) return; // if we aren't in a tag $curtag = implode("_",$this->current_tag); // piece together tag // this time for the arrays $j = $this->tagtracker["$curtag"]; if(!$j) $j = 0; if(!is_object($GLOBALS[$this->identifier]["$curtag"][$j])) { $GLOBALS[$this->identifier]["$curtag"][$j] = new xml_container; } $GLOBALS[$this->identifier]["$curtag"][$j]->store($name,$TD); #$this->tagdata["$curtag"]); unset($TD); return TRUE; } /* when expat finds some internal tag character data, it fires up this function */ function characterData($parser, $cdata) { $curtag = implode("_",$this->current_tag); // piece together tag $this->tagdata["$curtag"] .= $cdata; } /* this is the constructor: automatically called when the class is initialized */ function xml($data,$identifier='xml') { $this->identifier = $identifier; // create parser object $this->xml_parser = xml_parser_create(); // set up some options and handlers xml_set_object($this->xml_parser,$this); xml_parser_set_option($this->xml_parser,XML_OPTION_CASE_FOLDING,0); xml_set_element_handler($this->xml_parser, "startElement", "endElement"); xml_set_character_data_handler($this->xml_parser, "characterData"); if (!xml_parse($this->xml_parser, $data, TRUE)) { sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($this->xml_parser)), xml_get_current_line_number($this->xml_parser)); } // we are done with the parser, so let's free it xml_parser_free($this->xml_parser); } // end constructor: function xml() } // thus, we end our class xml /////////////////////////////////////////////////// /////////// end XML Class //////////////////////// $obj = new xml($upsResponse,"xml"); /// create the object $nine = trim($xml["TrackResponse_Response"][0]->ResponseStatusCode[0]); //////////////////////// if($nine == "1"){ $seven = $xml["TrackResponse_Shipment_ShipTo_Address"][0]->AddressLine1[0] . "\n"; $six = $xml["TrackResponse_Shipment_ShipTo_Address"][0]->AddressLine2[0] . "\n"; $five = $xml["TrackResponse_Shipment_ShipTo_Address"][0]->City[0] . "\n"; $four = $xml["TrackResponse_Shipment_ShipTo_Address"][0]->StateProvinceCode[0] . "\n"; $three = $xml["TrackResponse_Shipment_ShipTo_Address"][0]->PostalCode[0] . "\n"; $two = $xml["TrackResponse_Shipment_ShipTo_Address"][0]->CountryCode[0] . "\n"; $twelve = $xml["TrackResponse_Shipment_Package_PackageWeight_UnitOfMeasurement"][0]->Code[0] . "\n"; $eleven = $xml["TrackResponse_Shipment_Package_PackageWeight"][0]->Weight[0] . "\n"; $thirteen = $xml["TrackResponse_Shipment_Service"][0]->Description[0] . "\n"; ///current location $fourteen = $xml["TrackResponse_Shipment_Package_Activity_ActivityLocation"][0]->Description[0] . "\n"; $eighteen = $xml["TrackResponse_Shipment_Package_Activity_ActivityLocation_Address"][0]->City[0] . "\n"; $nineteen = $xml["TrackResponse_Shipment_Package_Activity_ActivityLocation_Address"][0]->CountryCode[0] . "\n"; $twenty = $xml["TrackResponse_Shipment_Package_Activity_ActivityLocation_Address"][0]->StateProvinceCode[0] . "\n"; $fifteen = $xml["TrackResponse_Shipment_Package_Activity_ActivityLocation"][0]->SignedForByName[0] . "\n"; // end location $sixteen = $xml["TrackResponse_Shipment_Package_Activity_Status_StatusType"][0]->Description[0] . "\n"; $seventeen = $xml["TrackResponse_Shipment_Package_Activity_Status_StatusType"][0]->Code[0] . "\n"; $twentyfour = $xml["TrackResponse_Shipment_Package_Activity"][0]->Date[0] . "\n"; $twentyfive = $xml["TrackResponse_Shipment_Package_Activity"][0]->Time[0] . "\n"; $yearx = substr("$twentyfour", 0, 4); $monthx = substr("$twentyfour", 4, 2); $dayx = substr("$twentyfour", 6, 2); $hhx = substr("$twentyfive", 0, 2); $mmx = substr("$twentyfive", 2, 2); $ssx = substr("$twentyfive", 4, 2); $seventeen = trim($seventeen); switch($seventeen){ case I: $stat = "In transit"; BREAK; case D: $stat = "Delivered"; BREAK; case X: $stat = "Exception"; BREAK; case P: $stat = "Pickup"; BREAK; case M: $stat = "Manifest Pickup"; BREAK; } ?>
Tracking Number:
Status:
Shipping Method:
Weight:
-
:
ErrorDescription[0]; echo "
".$eight."
"; ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// } /// end if nine is 1 or 0 ///////////////// /////////// end xml parser ///// } ///// end if action is track ?>
Package History "); for($i=0;$iDescription[0] . "\n"; $twentytwo = $xml["TrackResponse_Shipment_Package_Activity"][$i]->Date[0] . "\n"; $twentythree = $xml["TrackResponse_Shipment_Package_Activity"][$i]->Time[0] . "\n"; $twentyfour = $xml["TrackResponse_Shipment_Package_Activity_ActivityLocation_Address"][$i]->City[0] . "\n"; $twentyfive = $xml["TrackResponse_Shipment_Package_Activity_ActivityLocation_Address"][$i]->StateProvinceCode[0] . "\n"; $twentysix = $xml["TrackResponse_Shipment_Package_Activity_ActivityLocation_Address"][$i]->CountryCode[0] . "\n"; $year = substr("$twentytwo", 0, 4); $month = substr("$twentytwo", 4, 2); $day = substr("$twentytwo", 6, 2); $hh = substr("$twentythree", 0, 2); $mm = substr("$twentythree", 2, 2); $ss = substr("$twentythree", 4, 2); echo(""); if($xday != $day){ if($bgcolor == "#E1E1E1"){ $bgcolor = "#EFEEED"; ///echo("E1E1E1"); }else{ $bgcolor = "#E1E1E1"; ///echo("EFEEED"); } echo(""); }else{ echo(""); } $xmonth = $month; $xday = $day; $xyear = $xyear; echo(""); } echo("
DateTimeLocationActivity
".$month."/".$day."/".$year." ".$hh.":".$mm.":".$ss."".$twentyfour." ".$twentyfive." ".$twentysix."".$twentyone."

"); echo("Results provided by UPS ".date("F j, Y, g:i a T").".

NOTICE: UPS authorizes you to use UPS tracking systems solely to track shipments tendered by or for you to UPS for delivery and for no other purpose. Any other use of UPS tracking systems and information is strictly prohibited.


"); } /// end if 17 is X ?>