html - PHP error when trying to integrate facebook PHP SDK -


i’m new php , tying set page users can login using facebook php sdk , javascript sdk. keep getting fallowing error , don’t seem able find solution. saw similar post in here couldn’t give solution error.

parse error: syntax error, unexpected t_string, expecting ',' or ';' in /homepages/9/d321009915/htdocs/kno_login/login.php on line 2

here code:

<?php echo '<div id='fb-root'></div>';  require_once("facebook.php");  $config = array(); $config['appid'] = 'some id'; $config['secret'] = 'something here';  $facebook = new facebook($config); ?>   <script>   window.fbasyncinit = function() {   fb.init({     appid      : '293441190799565', // app id     channelurl : '//www.reyesmotion.com/kno_login/channel.html', // channel file     status     : true, // check login status     cookie     : true, // enable cookies allow server access session     xfbml      : true  // parse xfbml   });    // here subscribe auth.authresponsechange javascript event. event fired   // authentication related change, such login, logout or session refresh. means   // whenever logged out tries log in again, correct case below    // handled.    fb.event.subscribe('auth.authresponsechange', function(response) {     // here specify response anytime event occurs.      if (response.status === 'connected') {       // response object returned status field lets app know current       // login status of person. in case, we're handling situation        // have logged in app.       testapi();     } else if (response.status === 'not_authorized') {       // in case, person logged facebook, not app, call       // fb.login() prompt them so.        // in real-life usage, wouldn't want prompt login        // this, 2 reasons:       // (1) javascript created popup windows blocked browsers unless        // result direct interaction people using app (such mouse click)       // (2) bad experience continually prompted login upon page load.       fb.login();     } else {       // in case, person not logged facebook, call login()        // function prompt them so. note @ stage there no indication       // of whether logged app. if aren't they'll see login       // dialog right after log in facebook.        // same caveats above apply fb.login() call here.       fb.login();     }   });   };    // load sdk asynchronously   (function(d){    var js, id = 'facebook-jssdk', ref = d.getelementsbytagname('script')[0];    if (d.getelementbyid(id)) {return;}    js = d.createelement('script'); js.id = id; js.async = true;    js.src = "//connect.facebook.net/en_us/all.js";    ref.parentnode.insertbefore(js, ref);   }(document));    // here run simple test of graph api after login successful.    // testapi() function called in cases.    function testapi() {     console.log('welcome!  fetching information.... ');     fb.api('/me', function(response) {       console.log('good see you, ' + response.name + '.');     });   } </script>  <!--   below include login button social plugin. button uses javascript sdk   present graphical login button triggers fb.login() function when clicked.    learn more options login button plugin:   /docs/reference/plugins/login/ -->  <?php echo '<fb:login-button show-faces="true" width="200" max-rows="1"></fb:login-button>'; ?> 

just change outer single quotes double

echo "<div id='fb-root'></div>"; 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -