Subversion Repositories SmartDukaan

Rev

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

Rev 13659 Rev 13683
Line 89... Line 89...
89
       } 
89
       } 
90
       return $headers; 
90
       return $headers; 
91
    } 
91
    } 
92
 
92
 
93
	function make_request($url,$fields,$format='json'){
93
	function make_request($url,$fields,$format='json'){
94
		$this->log($url,'pythonapi');
94
		$this->log("[url] $url",'api');
95
		$this->log($fields,'pythonapi');
95
		$this->log("[fields] ".print_r($fields,1),'api');
96
		$fields_string = '';
96
		$fields_string = '';
97
		//open connection
97
		//open connection
98
		$ch = curl_init();
98
		$ch = curl_init();
99
		//set the url, number of POST vars, POST data
99
		//set the url, number of POST vars, POST data
100
		curl_setopt($ch,CURLOPT_URL, $url);
100
		curl_setopt($ch,CURLOPT_URL, $url);
Line 106... Line 106...
106
			    'Content-Length: ' . strlen($fields))                                                                       
106
			    'Content-Length: ' . strlen($fields))                                                                       
107
			);   
107
			);   
108
		}
108
		}
109
		//execute post
109
		//execute post
110
		$result = curl_exec($ch);
110
		$result = curl_exec($ch);
-
 
111
		$this->log("[response] ".print_r($result,1),'api');
111
		//close connection
112
		//close connection
112
		curl_close($ch);
113
		curl_close($ch);
113
		switch($format){
114
		switch($format){
114
			case 'json':
115
			case 'json':
115
			$response = json_decode($result,1);
116
			$response = json_decode($result,1);