Subversion Repositories Applications.annuaire

Rev

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

Rev 602 Rev 605
Line 20... Line 20...
20
		$curl = curl_init();
20
		$curl = curl_init();
21
		curl_setopt($curl, CURLOPT_URL, $url);
21
		curl_setopt($curl, CURLOPT_URL, $url);
22
		curl_setopt($curl, CURLOPT_POST, true);
22
		curl_setopt($curl, CURLOPT_POST, true);
23
		curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
23
		curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
24
		curl_setopt($curl, CURLOPT_POSTFIELDS, "username=$login&password=$password");
24
		curl_setopt($curl, CURLOPT_POSTFIELDS, "username=$login&password=$password");
-
 
25
		if ($this->config['auth']['curl_soft_ssl']) {
-
 
26
			curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
-
 
27
		}
25
		$res = curl_exec($curl);
28
		$res = curl_exec($curl);
26
		$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
29
		$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
27
		curl_close($curl);
30
		curl_close($curl);
Line 28... Line 31...
28
 
31
 
Line 32... Line 35...
32
			// (attention, répond même si l'authentification a échoué !)
35
			// (attention, répond même si l'authentification a échoué !)
33
			$url = "https://api.recolnat.org/erecolnat/v1/users/login/$login";
36
			$url = "https://api.recolnat.org/erecolnat/v1/users/login/$login";
34
			$curl = curl_init();
37
			$curl = curl_init();
35
			curl_setopt($curl, CURLOPT_URL, $url);
38
			curl_setopt($curl, CURLOPT_URL, $url);
36
			curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
39
			curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
-
 
40
			if ($this->config['auth']['curl_soft_ssl']) {
-
 
41
				curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
-
 
42
			}
37
			$res = curl_exec($curl);
43
			$res = curl_exec($curl);
38
			curl_close($curl);
44
			curl_close($curl);
Line 39... Line 45...
39
 
45
 
40
			$res = json_decode($res, true);
46
			$res = json_decode($res, true);
41
			//var_dump($res); exit;
47
			//var_dump($res); exit;
-
 
48
			if ($res != null) {
42
			if ($res != null) {
49
				unset($res['avatar']['data']); // trop gros, rentre pas dans le header du jeton et pète le service
43
				$this->jetonPartenaire = $res; // pas vraiment un jeton...
50
				$this->jetonPartenaire = $res; // pas vraiment un jeton...
44
				// stockage pour traitement dans les autres méthodes
51
				// stockage pour traitement dans les autres méthodes
45
				$this->data = $res;
52
				$this->data = $res;
46
				//var_dump($this->data); exit;
53
				//var_dump($this->data); exit;