Subversion Repositories eFlore/Applications.cel

Rev

Rev 908 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 908 Rev 946
Line 9... Line 9...
9
* @copyright	2010 Tela-Botanica
9
* @copyright	2010 Tela-Botanica
10
* @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
10
* @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
11
* @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
11
* @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
12
* @version		SVN: $Id$
12
* @version		SVN: $Id$
13
*/
13
*/
-
 
14
// TODO : remplacer les trigger_error par des exceptions qui pourrait ĂȘtre attrapĂ©es...
14
class CelRestClient {
15
class CelRestClient {
15
	const HTTP_URL_REQUETE_SEPARATEUR = '&';
16
	const HTTP_URL_REQUETE_SEPARATEUR = '&';
16
	const HTTP_URL_REQUETE_CLE_VALEUR_SEPARATEUR = '=';
17
	const HTTP_URL_REQUETE_CLE_VALEUR_SEPARATEUR = '=';
17
	private $http_methodes = array('GET', 'POST', 'PUT', 'DELETE', 'HEAD', 'OPTIONS', 'CONNECT', 'TRACE');
18
	private $http_methodes = array('GET', 'POST', 'PUT', 'DELETE', 'HEAD', 'OPTIONS', 'CONNECT', 'TRACE');
18
	protected $parametres = null;
19
	protected $parametres = null;
Line 120... Line 121...
120
	}
121
	}
Line 121... Line 122...
121
	
122
	
122
	private function analyserEntete() {
123
	private function analyserEntete() {
123
		$entetes = $this->reponse_entetes; 
124
		$entetes = $this->reponse_entetes; 
124
		$infos = array('date' => null, 'uri' => $this->url, 'debogages' => null);
-
 
125
		
125
		$infos = array('date' => null, 'uri' => $this->url, 'debogages' => null);
126
		if (isset($entetes['wrapper_data'])) {
126
		if (isset($entetes)) {
127
			$entetes = $entetes['wrapper_data'];
-
 
128
		}
127
			if (isset($entetes['wrapper_data'])) {
129
		foreach ($entetes as $entete) {
-
 
130
			if (preg_match('/^X_REST_DEBOGAGE_MESSAGES: (.+)$/', $entete, $match)) {
-
 
131
				$infos['debogages'] = json_decode($match[1]);
128
				$entetes = $entetes['wrapper_data'];
-
 
129
			}
-
 
130
			foreach ($entetes as $entete) {
-
 
131
				if (preg_match('/^X_REST_DEBOGAGE_MESSAGES: (.+)$/', $entete, $match)) {
-
 
132
					$infos['debogages'] = json_decode($match[1]);
132
			}
133
				}
133
			if (preg_match('/^Date: .+ ([012][0-9]:[012345][0-9]:[012345][0-9]) .*$/', $entete, $match)) {
134
				if (preg_match('/^Date: .+ ([012][0-9]:[012345][0-9]:[012345][0-9]) .*$/', $entete, $match)) {
-
 
135
					$infos['date'] = $match[1];
134
				$infos['date'] = $match[1];
136
				}
135
			}
137
			}
136
		}
138
		}
137
		return $infos;
139
		return $infos;