이봐, 나는이 문제 ...FB-링크를 공유 한 후 작동하지 mysql을 삽입
나는 사용자가 난에 자신의 ID를 얻을, 내 페이스 북 앱에서 링크를 공유했습니다 때 싶습니다 내 db.
내가 링크를 공유하는 방법은 내가
공유 수정 한 자바 스크립트 예를 들어 페이스 북의 대화 자바 스크립트 코드를 통해입니다
<script>
FB.init({appId: 'xxxx', channelUrl: 'xxxx', status: true, cookie: true});
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
name: 'Facebook Dialogs',
caption: 'Reference Documentation',
description: 'Using Dialogs to interact with users.'
};
function callback(response) {
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
document.getElementById('post').style.display = "none";
}
}
xmlhttp.open("POST","shared.php",true);
xmlhttp.send("id=xxx");
}
FB.ui(obj, callback);
}
</script>
PHP의 코드
$con = mysqli_connect("xxxx","xxx","xxx","xxx");
if (!$con) {
die('Could not connect: ' . mysql_error());
};
mysqli_query($con, "INSERT INTO xxx (fb-id) VALUES (".$_POST['id'].")");
mysqli_close($con)
I을 나는 post_id를 얻을 수있는 링크를 공유하고 있지만 DB에는 아무것도 없다.
아무도 말할 수 있습니까?
Facebook 정책에 따라 해당 사용자의 ID를 저장할 수 있는지 확인할 수 있습니다. – Madbreaks
나는 사용자 아이디를 저장하지만 사용자 이름과 패스워드를 허용하지 않는다;) –