I want to use fb graph api in code igniter. The file is:
$app_id = 'xxxx';
$app_secret = 'xxxx';
$redirect_url='http://onlineislamicquiz.net/facebook';
//3.Initialize application, create helper object and get fb sess
FacebookSession::setDefaultApplication($app_id,$app_secret);
$session="";
$helper = new FacebookRedirectLoginHelper($redirect_url);
try
{
$session = $helper->getSessionFromRedirect();
}
catch(FacebookRequestException $ex)
{
echo "Facebook returns error";
}
catch(\Exception $ex)
{
echo "There are some issues in your app";
}
// Setting facebook token to check whether user has logged in or not
if ( isset($_SESSION['fb_token']))
{
$session = new FacebookSession($_SESSION['fb_token']);
echo "Session exists already";
}
// The Url for logging out
if (!$session)
{
//store the session in a token
//else echo login
echo '<a href='.$helper->getLoginUrl(array('email')).'>';
?>
<button class="btn btn-primary">Sign up with : <i class="fa fa-facebook-square fa-2x"></i></button>
<?php
echo '</a>';
}
There is a controller at :
which handles backend.
I want to redirect to the:
But, it redirects me to:
which is not found. The htaccess is:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
<Files "index.php">
AcceptPathInfo On
</Files>
Looks like there is something wrong with .htaccess. Please help me to solve this.
try it RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 !^(index\.php|images|js|uploads|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.