PHP Error - Try_Catch [closed]

2
  

Parse error: syntax error, unexpected 'catch' (T_CATCH), expecting end of file in C: \ xampp \ htdocs \ validar_cad_user \ face.php on line 65

My Project is there if anyone can help, Thanks!

    try {
                 // Returns a 'Facebook\FacebookResponse' object
                $response = $fb->get('/me?fields=name, picture, email');
                $user = $response->getGraphUser();
                //var_dump($user);
                $result_usuario = "SELECT id, nome, email FROM usuario WHERE email='".$user['email']."' LIMIT 1";
                $resultado_usuario = mysqli_query($conn, $result_usuario);
                if($resultado_usuario){
                    $row_usuario = mysqli_fetch_assoc($resultado_usuario);
                        $_SESSION['id'] = $row_usuario['id'];
                        $_SESSION['nome'] = $row_usuario['nome'];
                        $_SESSION['email'] = $row_usuario['email'];
                        header("Location: administrativo.php");
                    }
                }               
            } catch(Facebook\Exceptions\FacebookResponseException $e) {
                echo 'Graph returned an error: ' . $e->getMessage();
                exit;
            } catch(Facebook\Exceptions\FacebookSDKException $e) {
                echo 'Facebook SDK returned an error: ' . $e->getMessage();
                exit;
            }
    
asked by anonymous 06.02.2018 / 12:56

1 answer

1

You probably forgot a semicolon:

Here's an example of Exceptions

<?php
function inverse($x) {
    if (!$x) {
        throw new Exception('Divisão por zero.');
    }
    return 1/$x;
}

try {
    echo inverse(5) . "\n";
    echo inverse(0) . "\n";
} catch (Exception $e) {
    echo 'Exceção capturada: ',  $e->getMessage(), "\n";
}

// Execução continua
echo "Olá mundo\n";
?>
    
06.02.2018 / 12:57