Subversion Repositories Applications.framework

Compare Revisions

Regard whitespace Rev 469 → Rev 470

/branches/v0.3-aleaume/framework/RestClient.php
9,7 → 9,7
* @copyright Copyright (c) 2010, Tela Botanica (accueil@tela-botanica.org)
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
* @version $Id$
* @since 0.2
*/
class RestClient {
const HTTP_URL_REQUETE_SEPARATEUR = '&';
76,15 → 76,20
if ($mode == 'GET') {
$this->traiterUrlParametres();
}
$content = http_build_query($donnees, null, self::HTTP_URL_REQUETE_SEPARATEUR);
$contexte = stream_context_create(array(
'http' => array(
'method' => $mode,
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'content' => http_build_query($donnees, null, self::HTTP_URL_REQUETE_SEPARATEUR))));
'content' => $content)));
$flux = @fopen($this->url, 'r', false, $contexte);
if (!$flux) {
$this->reponse_entetes = $http_response_header;
$e = "L'ouverture de l'url '{$this->url}' par la méthode HTTP '$mode' a échoué!";
$entetesFmt = print_r($this->analyserEntete(), true);
$e = "L'ouverture de l'url '{$this->url}' par la méthode HTTP '$mode' a échoué!\n".
"Le contenu des métadonnées était : $entetesFmt \n".
"Les paramètres de la requête HTTP étaient : $content \n".
"Le contenu était : ".stream_get_contents($flux);
trigger_error($e, E_USER_WARNING);
} else {
// Informations sur les en-têtes et métadonnées du flux