<?php
class netsTaobaoInfo extends netsError {
	private $sysErrorClassID='1202';
	private $sysErrorFuncID=0;
	private $sysErrorID=0;
	
	public $sApiName='virtuala';
	public $sApiKey='12056677';
	public $sApiSecret='aa68718a6d55287e70dd3db3a4641340';
	/*
	public $sApiName='virtuala';
	public $sApiKey='12142924';
	public $sApiSecret='6aac4c6252bf3b15b4076d63e0d93217';
	*/
	public $sAPIURL='http://gw.api.taobao.com/router/rest?';
	public $sParameters= array(
		'format'=>'xml',
		'v'=>'2.0',
		'timestamp'=>'',
		'session'=>'',
		'sign_method'=>'md5',
		
		'api_key'=>'12142924',
		'nick'=>'',
		'sign'=>'',
		
		'method'=>'taobao.trades.sold.get',
		'fields'=>'tid,seller_nick,buyer_nick,status,orders.title,orders.price,orders.num',

	);
	
	public function netsTaobaoInfo(){
		$this->netsError();
	}
	
	public function createSIGN(){
		$tmpSTR='';
		
		$this->sParameters['api_key']=$this->sApiKey;
		$this->sParameters['timestamp']=date($this->sysTimeFormat);
		$tmpAR0=array(
			'method'=>$this->sParameters['method'],
			'fields'=>$this->sParameters['fields'],
			'nick'=>$this->sParameters['nick'],
			'api_key'=>$this->sParameters['api_key'],
			'format'=>$this->sParameters['format'],
			'v'=>$this->sParameters['v'],
			'sign_method'=>$this->sParameters['sign_method'],
			'timestamp'=>$this->sParameters['timestamp'],
			);
			
		ksort($tmpAR0);
		$Coun0=0;
		foreach($tmpAR0 as $tmpKey=>$tmpValue){
			if($tmpKey!='' && $tmpValue!=''){
				$tmpSTR.=$tmpKey.$tmpValue;
				$Coun0++;
			}
		}
		$tmpSTR=strtoupper(md5($this->sApiSecret.$tmpSTR.$this->sApiSecret));
		
		return $tmpSTR;
	}
	public function createParameter(){
		$tmpSTR='';
		
		$this->sParameters['api_key']=$this->sApiKey;
		$this->sParameters['timestamp']=date($this->sysTimeFormat);
		$tmpAR0=$this->sParameters;
		
		ksort($tmpAR0);
		$Coun0=0;
		foreach($tmpAR0 as $tmpKey=>$tmpValue){
			if($tmpKey!='' && $tmpValue!=''){
				if ($Coun0>0) {
					$tmpSTR.='&';
				}
				$tmpSTR.=$tmpKey.'='.urlencode($tmpValue);
				$Coun0++;
			}
		}
		
		return $tmpSTR;
	}


}
?>