⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 _ups.php

📁 集成了投票调查、流量统计、文件上传、留言版、论坛、软件下载、文章赏析、通讯录、网上购物 等板块 管理账户为peilei 密码为800901
💻 PHP
字号:
<?php 

网络商店 - 吉鑫网络
 http://www.chinaifc.com

Copyright (c) 2001,2003 网络商店

    汗化版权所有吉鑫网络
*/
  class _Ups { 

    function upsProduct($prod){ 
        
     /* 
     1DM == Next Day Air Early AM 
     1DA == Next Day Air 
     1DP == Next Day Air Saver 
     2DM == 2nd Day Air Early AM 
     2DA == 2nd Day Air 
     3DS == 3 Day Select 
     GND == Ground 
     STD == Canada Standard 
     XPR == Worldwide Express 
     XDM == Worldwide Express Plus 
     XPD == Worldwide Expedited 
     */ 
      $this->upsProductCode = $prod; 
    } 
     
    function origin($postal, $country){ 
      $this->originPostalCode = $postal; 
      $this->originCountryCode = $country; 
    } 

    function dest($postal, $country){ 
      $postal = str_replace(' ', '', $postal);
      if ($country == 'US') {
	$this->destPostalCode = substr($postal, 0, 5);
      } else {
	$this->destPostalCode = $postal; 
      }
      $this->destCountryCode = $country; 
    } 

    function rate($foo){ 
      switch($foo){ 
        case  "RDP": 
          $this->rateCode =  "Regular+Daily+Pickup"; 
          break; 
        case  "OCA": 
          $this->rateCode =  "On+Call+Air"; 
          break; 
        case  "OTP": 
          $this->rateCode =  "One+Time+Pickup"; 
          break; 
        case  "LC": 
          $this->rateCode =  "Letter+Center"; 
          break; 
        case  "CC": 
          $this->rateCode =  "Customer+Counter"; 
          break; 
      } 
    } 

    function container($foo){ 
          switch($foo){ 
        case  "CP":             // Customer Packaging 
          $this->containerCode =  "00"; 
          break; 
               case  "ULE":         // UPS Letter Envelope 
          $this->containerCode =  "01";         
          break; 
        case  "UT":             // UPS Tube 
          $this->containerCode =  "03"; 
          break; 
        case  "UEB":             // UPS Express Box 
          $this->containerCode =  "21"; 
          break; 
        case  "UW25":         // UPS Worldwide 25 kilo 
          $this->containerCode =  "24"; 
          break; 
        case  "UW10":         // UPS Worldwide 10 kilo 
          $this->containerCode =  "25"; 
          break; 
      } 
    } 
     
    function weight($foo){ 
      $this->packageWeight = $foo; 
    } 

    function rescom($foo){ 
          switch($foo){ 
        case  "RES":             // Residential Address 
          $this->resComCode =  "1"; 
          break; 
        case  "COM":             // Commercial Address 
          $this->resComCode =  "2"; 
          break; 
          } 
    } 

    function getQuote(){ 
          $upsAction =  "3";  // You want 3.  Don't change unless you are sure. 
      $url = join( "&",  
               array( "http://www.ups.com/using/services/rave/qcostcgi.cgi?accept_UPS_license_agreement=yes", 
                      "10_action=$upsAction", 
                      "13_product=$this->upsProductCode", 
                      "14_origCountry=$this->originCountryCode", 
                      "15_origPostal=$this->originPostalCode", 
                      "19_destPostal=$this->destPostalCode", 
                      "22_destCountry=$this->destCountryCode", 
                      "23_weight=$this->packageWeight", 
                      "47_rate_chart=$this->rateCode", 
                      "48_container=$this->containerCode", 
                      "49_residential=$this->resComCode" 
           ) 
                ); 
      $fp = fopen($url,  "r"); 
      while(!feof($fp)){ 
        $result = fgets($fp, 500); 
        $result = explode( "%", $result); 
        $errcode = substr($result[0], -1); 
        switch($errcode){ 
          case 3: 
            $returnval = $result[8]; 
                break; 
          case 4: 
            $returnval = $result[8]; 
            break; 
          case 5: 
            $returnval = $result[1]; 
            break; 
          case 6: 
            $returnval = $result[1]; 
            break; 
        } 
      } 
      fclose($fp); 
          if(! $returnval) { $returnval =  "error"; } 
      return $returnval; 
    } 
  } 

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -