Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Boa tarde, não tenho conhecimento sobre o Zend Framework
Criei um faceAction no logincontroller.php
public function faceAction()
{
$fb_cad = $this->_getParam('fb_cad');
$code = $this->_getParam('code');
$this->_helper->layout->disableLayout();
if($_SERVER['REQUEST_METHOD'] == 'GET' && isset($code))$appId = 'xxxxxxxxx';
$appSecret = 'xxxxxxxxxxxxxxxxxxxxxxxxxx';$token_url = "https://graph.facebook.com/oauth/access_token?client_id=".$appId."&redirect_uri=".$redirectUri."&client_secret=".$appSecret."&code=".$code;
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $token_url);
curl_setopt($ch, CURLOPT_USERAGENT , isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? $_SERVER[ 'HTTP_USER_AGENT' ] : "Mozilla/4.0" );
curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch); curl_close($ch);
$token = explode('=', $response); $access_token = $token[1];
// echo $token_url;
// echo '<br><pre>'; print_r($response); echo '<pre>'; $graph_url = "https://graph.facebook.com/me?access_token=".$access_token;
$user = json_decode(file_get_contents($graph_url));
// echo '<pre>'; print_r($user); echo '</pre>'; $email = addslashes($user->email);
//echo '<pre>'; print_r($user); echo '</pre>';
/* ------------------------------------------------------ */if ($login->isValid($data)) {
$dados = $login->getValues();
$autentique = Default_Model_Login::login($dados['login'], $dados['senha']);$cesta = $_SESSION['CARRINHO'];
if (!empty($_COOKIE['CARRINHO']))
$cesta = $_COOKIE['CARRINHO'];
$cesta = unserialize($cesta);
$this->_redirect($refer);
}$this->_helper->flashMessenger(array('alert alert-message' => $autentique['error']));
$login->populate($data);
}
}?>
<center><div style="height:250px" id="divFace"><div class="geraIframe" style="color:#999; font-size:16px; margin:0 auto; padding:15px; margin-top:50px"
align="center"><?php echo '000'.$erro.': '.$msgErro;?><br /><br /><a href="[http://unearte.com.br/](http://unearte.com.br/)" class="botao_lar">Página Inicial</a></div></div></center>
<?php
}
else if($_SERVER['REQUEST_METHOD'] == 'GET' && isset($_GET['error']))
{
echo "<script type=\"text/javascript\">window.location='http://unearte.com.br';</script>";
}
}
Destaquei o trecho que não estou conseguindo prosseguir
precisava ver se o email existe no banco e efetuar o login
Obrigado
Att. Brambilla