Issue
I want to provide logging with facebook on my webpage. How can I use both APIs to get some facebook user info using PHP in one place and JS in other place? This is link to offical php sdk example usage (together with JS sdk):
https://github.com/facebook/php-sdk/blob/master/examples/with_js_sdk.php
What i want to do is to use somewhere in that file this code for example:
FB.api("/me", function (response) {
alert('Name is ' + response.name);
});
or other JS sdk code to get some user info.
I always have a problem that when I use one type of logging in (PHP or JS) I can use only one kind of api to call for info. I don't know how to provide logging in which will make available both APIs. Someone knows how to do it? Thanks for help!
Solution
you can just using the php sdk at the same time still can you js api, in your script, just add this in your html body ,
<div id="fb-root"></div>
<script type="text/javascript" src="https://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
FB.init({
appId : '<?=$yourappid?>',
status : true,
cookie : true,
xfbml : true
});
</script>
and try call call this
<script type="text/javascript">
FB.api("/me", function (response) {
alert('Name is ' + response.name);
});
</script>
anyone pls correct me if i'm wrong
Answered By - Suriyanti Panagen
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.