1
getUser를 사용하는 facebook 페이지 탭에 응용 프로그램이있어서 Chrome 및 Firefox에서 모두 작동하는 해당 사용자의 Facebook ID를 얻을 수 있습니다. 그러나 IE에는 없습니다. 여러 번 캐시를 지우려고했습니다!facebook 팬 페이지 탭의 getUser() IE에서만 내부 서버 오류를 표시하는 iframe
https://www.facebook.com/dialog/oauth?client_id=1397280120532513&redirect_uri=https%3A%2F%2FMYWEBSITE.com%2Fmatchgame%2Fregister&state=bc353f470176d5a62995722808e3f406&sdk=php-sdk-3.2.3&scope=email%2C+user_birthday%2C+publish_actions%2C+publish_stream
이 오류와 함께 아무것도 할 필요가 있지만 내가 그랬다면 나도 몰라 : 여기에 내가 뭐하는 거지입니다
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Register extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->library('facebook', $this->config->item('fb_config'));
$this->load->library('Form_validation');
$this->load->library('session');
$this->load->model('users_model', 'users');
}
public function index() {
$user_id = $this->facebook->getUser();
if ($user_id) {
// We have a user ID, so probably a logged in user.
// If not, we'll get an exception, which we handle below.
try {
$user_profile = $this->facebook->api('/me', 'GET');
$data['fb_id'] = $user_profile['id'];
$this->session->set_userdata('fb_id', $data['fb_id']);
$users = $this->users->get_by_fb_id_register($data['fb_id'], array('full_name', 'age', 'email', 'phone_number'));
// not first time
if ($users != 0 && $users->num_rows() < 1) {
$data['full_name'] = $user_profile['name'];
$birthDate = explode("/", $user_profile['birthday']);
$age = (date("md", date("U", mktime(0, 0, 0, $birthDate[0], $birthDate[1], $birthDate[2]))) > date("md") ? ((date("Y") - $birthDate[2]) - 1) : (date("Y") - $birthDate[2]));
$data['age'] = $age;
$data['email'] = $user_profile['email'];
} else {
$data = $users->row_array();
}
} catch (FacebookApiException $e) {
// If the user is logged out, you can have a
// user ID even though the access token is invalid.
// In this case, we'll get an exception, so we'll
// just ask the user to login again here.
$login_url = $this->facebook->getLoginUrl(
array(
'scope' => 'email, user_birthday, publish_actions, publish_stream', //read_stream, friends_likes, user_likes
// 'redirect_uri' => $this->config->item('fan_page_app_link'), //the url to go to after a successful login
));
echo '<script> window.top.location.href = "' . $login_url . '"; </script>';
exit;
}
} else {
// No user, print a link for the user to login
$login_url = $this->facebook->getLoginUrl(
array(
'scope' => 'email, user_birthday, publish_actions, publish_stream', //read_stream, friends_likes, user_likes
'redirect_uri' => $this->config->item('fan_page_app_link'), //the url to go to after a successful login
));
echo '<script> window.top.location.href = "' . $login_url . '"; </script>';
exit;
}
}
?>
오류 (500)을 제공하는 URL (이 CodeIgniter는 프레임 워크입니다) 이 라인
Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYPEER] = false;
,536,913에게 Facebook.php로 이름을 바꿉니다
내가 facebook.php 파일에 한 유일한 변화되고 추가 : 다음 __construct 에 63,210
나는 모든 세 개의 파일 althoug
Invalid or no certificate authority found, using bundled information
가 facebook.php이 오류가 발생했기 때문에, base_facebook.php 및 fb_ca_chain_bundle.crt는 라이브러리 폴더, 모두 같은 폴더에있는
헤더 이후의 HTML 파일의 상단이 코드그래서
<script type="text/javascript">
function NotInFacebookFrame() {
return top === self;
}
function ReferrerIsFacebookApp() {
if (document.referrer) {
return document.referrer.indexOf("apps.facebook.com") != -1;
}
return false;
}
if (NotInFacebookFrame() || ReferrerIsFacebookApp()) {
top.location.replace("<?php echo $this->config->item('fan_page_app_link'); ?>");
}
</script>
해당 사용자가 직접 어플리케이션 액세스하면 사이트에서 그는 페이스 북 웹 사이트로 리디렉션됩니다.
업데이트
그때 나는 페이스 북에서 응용 프로그램을 다시 머리 URL을 https://MYWEBSITE.com/matchgame/register를 사용하여 내 웹 사이트에서 직접 응용 프로그램을 입력, 그것은 일을 솔기 i를 입력하면 차단되고 일부 쿠키가있는 경우 페이 스북에서 응용 프로그램!