<?php class djangoOdooServer { public static function getUserAttributes($user,$pass) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, COOPERATIC_DJANGO_ODOO_URL); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); // fp is needed for compatibility : random string is fine for this $datas = array("login"=>$user,"password"=>$pass, "fp"=>substr(str_shuffle(MD5(microtime())), 0, 16)); curl_setopt($ch, CURLOPT_POSTFIELDS, $datas); $response = curl_exec($ch); if ($response) { try { return json_decode($response); } catch (Exception $e) { return NULL; } } } }