Subversion Repositories SmartDukaan

Rev

Rev 17897 | Rev 19233 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 17897 Rev 18111
Line 685... Line 685...
685
		if($count==0){
685
		if($count==0){
686
			$this->Appacl->create();
686
			$this->Appacl->create();
687
			$this->Appacl->save($data);
687
			$this->Appacl->save($data);
688
		}	
688
		}	
689
    }
689
    }
-
 
690
    
-
 
691
	function post_request_dont_use($url,$fields,$format='json'){
-
 
692
		$this->log("[url] $url",'api');
-
 
693
		$this->log("[fields] ".print_r($fields,1),'api');
-
 
694
		$fields_string = '';
-
 
695
		//open connection
-
 
696
		$ch = curl_init();
-
 
697
		//execute post
-
 
698
		foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
-
 
699
		rtrim($fields_string, '&');
-
 
700
		//set the url, number of POST vars, POST data
-
 
701
		curl_setopt($ch,CURLOPT_URL, $url);
-
 
702
		curl_setopt($ch,CURLOPT_POST, count($fields));
-
 
703
		curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
-
 
704
		curl_setopt($ch,CURLOPT_HTTPHEADER, array('Content-Type: multpipart/form-data'));
-
 
705
		$result = curl_exec($ch);
-
 
706
		$this->log("[response] ".print_r($result,1),'api');
-
 
707
		//close connection
-
 
708
		curl_close($ch);
-
 
709
		switch($format){
-
 
710
			case 'json':
-
 
711
			$response = json_decode($result,1);
-
 
712
			break;
-
 
713
		}
-
 
714
		return $response;	
-
 
715
	}
690
}
716
}