<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: 			*/
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | Copyright (c) 2004-2010 ARMIA INC                                    |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts VistaCart                     |
// +----------------------------------------------------------------------+
// | Authors: Jipson<jipson.thomas@armiasystems.com>             		  |
// +----------------------------------------------------------------------+
class AustraliapostComponent extends Object{
	var $Pickup_Postcode 		= "2000";
    var $Destination_Postcode 	= "2500";
    var $Country 				= "au";
    var $Weight 				= "1000";
    var $Service_Type			= "STANDARD";
    var $Length					= "100";
    var $Width					= "100";
    var $Height					= "100";
    var $Quantity 				= "1";
	function set_Pickup_Postcode($Pickup_Postcode) {
        $this->Pickup_Postcode = $Pickup_Postcode;
    }
	function set_Destination_Postcode($Destination_Postcode) {
        $this->Destination_Postcode = $Destination_Postcode;
    }
	function set_Country($Country) {
        $this->Country = $Country;
    }
	function set_Weight($Weight) {
        $this->Weight = $Weight;
    }
	function set_Service_Type($Service_Type) {
        $this->Service_Type = $Service_Type;
    }
	function set_Length($Length) {
        $this->Length = $Length;
    }
	function set_Width($Width) {
        $this->Width = $Width;
    }
	function set_Height($Height) {
        $this->Height = $Height;
    }
	function set_Quantity($Quantity) {
        $this->Quantity = $Quantity;
    }
	function getRate(){
		$serviceArray=array("STANDARD"=>"Standard Post","EXPRESS"=>"Express Post","AIR"=>"Air Post","SEA"=>"Sea Post","ECONOMY"=>"Economy Post","EPI"=>"International Express Post");
		$i	=	0;
		foreach($serviceArray as $key=>$value)
		{
			$query = 'Pickup_Postcode='.$this->Pickup_Postcode;
			$query .= '&Destination_Postcode='.$this->Destination_Postcode;
			$query .= '&Country='.$this->Country;
			$query .= '&Weight='.$this->Weight;
			$query .= '&Service_Type='.$key;
			$query .= '&Length='.$this->Length;
			$query .= '&Width='.$this->Width;
			$query .= '&Height='.$this->Height;
			$query .= '&Quantity='.$this->Quantity;
			$myfile = file('http://drc.edeliver.com.au/ratecalc.asp?'.$query);
			//print_r($myfile);exit;
			$APchargeArray = explode('=',$myfile[0]);
			$charge = $APchargeArray[1];
			if($charge!=0)
			{
				$arr[$i]["title"]	=	$value;
				$arr[$i]["cost"]	=	$charge;
				$i++;
			}
		}
		if(isset($arr) && empty($arr)===false)
		return $arr;
		else
		return '';

	}
	
}

?>