Пример #1
0
 /**
  * 
  * @param unknown $response
  * @return boolean
  */
 public function captateUser()
 {
     if ($this->facebook->hasAccessToken()) {
         $this->logger->debug('user has access token : ' . $this->facebook->getAccessToken());
         try {
             $this->logger->debug('facebook load data');
             // load and store profile.
             $profile = $this->facebook->retriveProfile();
             // geolocate and store the ip
             $location = $this->facebook->retriveLocationFromIp();
             if ($location) {
                 $this->facebook->storeLocationInProfile($location);
             } else {
                 $this->logger->error('Unable to geolocate user');
             }
             return true;
         } catch (\Exception $ex) {
             $this->logger->error($_SERVER['HTTP_USER_AGENT'] . ' - ' . $ex->getMessage());
             return false;
         }
     }
 }