Beispiel #1
0
 /**
  * Méthode de demande d'authentication pour le service google souhaité
  * @return void
  */
 private function login()
 {
     $r = new Request(self::URL_LOGIN);
     $r->setOption(CURLOPT_FOLLOWLOCATION, true);
     $r->setOption(CURLOPT_SSL_VERIFYPEER, 0);
     $data = array('accountType' => $this->account_type, 'Email' => $this->email, 'Passwd' => $this->password, 'source' => self::SOURCE, 'service' => $this->service);
     $r->setDataPost($data);
     $retour = $r->execute();
     $retour = preg_replace("/(\n|\r)/", "", $retour);
     $toParse = array("Auth", "LSID", "SID");
     foreach ($toParse as $var) {
         if (preg_match("/" . $var . "=(.*)\$/", $retour, $extract, PREG_OFFSET_CAPTURE)) {
             try {
                 $this->{$var} = $extract[1][0];
                 $retour = preg_replace("/" . $var . "=.*\$/", "", $retour);
             } catch (Exception $e) {
                 return;
             }
         } else {
             return;
         }
     }
 }