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

📄 _fedex.php

📁 集成了投票调查、流量统计、文件上传、留言版、论坛、软件下载、文章赏析、通讯录、网上购物 等板块 管理账户为peilei 密码为800901
💻 PHP
字号:
<?php
	/*
	 * $Id: _fedex.php,v 1.2 2002/05/13 11:53:51 thomasamoulton Exp $
	网络商店 - 吉鑫网络
 http://www.chinaifc.com

Copyright (c) 2001,2003 网络商店

    汗化版权所有吉鑫网络
*/
	$rate = new FedEx();
	$rate->SetOrigin(95991, 'US');
	$rate->SetDest(C1C1C1, 'CA');
	$rate->SetWeight(50);
	$quote = $rate->GetQuote();
	print $quote['Service'] . "<br>";
	print $quote['TotalCharges'] . "\n";
*/
	class _FedEx {
		var $Screen = 'Ground';
		var $OriginZip;
		var $OriginCountryCode = 'US';
		var $DestZip;
		var $DestCountryCode = 'US';
		var $Weight = 0;
		var $WeightUnit = 'LBS';
		var $Length = 0;
		var $Width = 0;
		var $Height = 0;
		var $DimUnit = 'IN';
		function _FedEx($zip = NULL, $country = NULL) {
			if($zip) {
				$this->SetOrigin($zip, $country);
			}
		}
		function SetOrigin($zip, $country = NULL) {
			$this->OriginZip = $zip;
			if($country) {
				$this->OriginCountryCode = $country;
			}
		}
		function SetDest($zip, $country = NULL) {
			$zip = str_replace(" ", "", $zip);
			$zip = str_replace("-", "", $zip);
			if ($country == "US") $this->DestZip = substr($zip, 0, 5);
			else $this->DestZip = $zip;
			if($country) {
				$this->DestCountryCode = $country;
			}
		}
		function SetWeight($weight, $units = NULL) {
			if ($weight < 1) $this->Weight = 1;
			else $this->Weight = $weight;
			if($units) {
				$this->WeightUnit = $units;
			}
		}
		function SetSize($length = NULL, $width = NULL, $height = NULL, $units = NULL) {
			if($length) {
				$this->Length = $length;
			}
			if($width) {
				$this->Width = $width;
			}
			if($height) {
				$this->Height = $height;
			}
			if($units) {
				$this->DimUnit = $units;
			}
		}

		function GetQuote() {
			$url = array(
				'http://grd.fedex.com/cgi-bin/rrr2010.exe?func=Rate',
				'Screen=' . $this->Screen,
				'OriginZip=' . $this->OriginZip,
				'OriginCountryCode=' . $this->OriginCountryCode,
				'DestZip=' . $this->DestZip,
				'DestCountryCode=' . $this->DestCountryCode,
				'Weight=' . $this->Weight,
				'WeightUnit=' . $this->WeightUnit,
				'DimUnit=' . $this->DimUnit
			);
			if($this->Length) {
				$url[] = 'Length=' . $this->Length;
			}
			if($this->Width) {
				$url[] = 'Width=' . $this->Width;
			}
			if($this->Height) {
				$url[] = 'Height=' . $this->Height;
			}
			$url = join('&', $url);
			$fp = fopen($url, 'r');
			while(!feof($fp)) {
				$line = trim(fgets($fp, 1024));
				if($line == '<!-- End Reply Message -->') {
					break;
				}
				if($ok) {
					$p = strpos($line, '>');
					$tag = substr($line, 2, ($p - 2));
					$text = strip_tags($line);
					if($line[1] == '!') {
// print "<!-- " . htmlentities($tag) . " - " . htmlentities($text) . " -->\n";
						$output[$tag] = $text;
					}
				}
				else {
					if($line == '<!-- Begin Reply Message -->') {
						$ok = 1;
					}
				}
			}
			fclose($fp);
			return $output;
		}
	}
?>

⌨️ 快捷键说明

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