// UPD Shipping Calculator function getUPSprice($shipType="GND",$sendZipcode="17011",$recieveZipcode="90210",$recieveCountry = "US",$weight="0",$r="0") { /* UPS Service UPS Product Code --------------------------------------------- Next Day Air Early 1DM Next Day Air 1DA Next Day Air Intra 1DAPI (Puerto Rico) Next Day Air Saver 1DP 2nd Day Air A M 2DM 2nd Day Air 2DA 3 Day Select 3DS Ground GND Canada Standard STD Worldwide Express XPR Worldwide Express XDM Worldwide Expedited XPD */ $tmp = "AppVersion=1.2&AcceptUPSLicenseAgreement=yes&ResponseType=application/x-ups-rss&ActionCode=3". "&RateChart=Customer+Counter&DCISInd=0&SNDestinationInd1=0&SNDestinationInd2=0&ResidentialInd=$r&PackagingType=00". "&ServiceLevelCode=$shipType&ShipperPostalCode=".substr($sendZipcode, 0, 5)."&ConsigneePostalCode=". substr($recieveZipcode, 0, 5). "&ConsigneeCountry=$recieveCountry&PackageActualWeight=$weight&DeclaredValueInsurance=0\n\r"; $request = "POST /using/services/rave/qcost_dss.cgi HTTP/1.0\nContent-type: application/x-www-form-urlencoded\nContent-length: " . strlen($tmp) . "\n\n" . $tmp; $this->socket = fsockopen("www.ups.com", 80); fputs($this->socket, $request); strtok(fread ($this->socket, 4096), "%"); for ($i = 0; $i < 12 ;$i++) { $price = strtok("%"); } fclose($this->socket); return($price); } ?>