title: Including content of php file in html page
body: <p>My php file is:</p>
  
  <pre><code>&lt;?php
  session_start();
  
      if (!class_exists('FacebookApiException')) {
      require_once('facebook.php' );
      }
          $facebook = new Facebook(array(
          'appId' =&gt; $appId,
          'secret' =&gt; $appSecret,
      ));
      $fbuser = $facebook-&gt;getUser();
   if ($fbuser) {
          try {
           $user_interest = $facebook-&gt;api('/me/movies');
          echo '&lt;pre&gt;';
          //print_r($user_interest);
          }
   catch (FacebookApiException $e) {
      echo '&lt;pre&gt;'.htmlspecialchars(print_r($e, true)).'&lt;/pre&gt;';
      $user = null;
    }}
  ?&gt;
  </code></pre>
  
  <p>I want to use $user_interest and other var in html code in php file:
  I tried in following way which gives error $user_interest not defined.</p>
  
  <pre><code>&lt;?php
  session_start();
  $appId = '619'; 
  $appSecret = 'myverybeatuifuldaisygiveusmilk'; // Facebook App Secret
  $return_url = 'http://yoursite.com/connect_script/';  //path to script folder
  $fbPermissions = 'publish_stream,email'; //more permissions : https://developers.facebook.com/docs/authentication/permissions/
  require_once('facebook.php' );
  $facebook = new Facebook(array(
          'appId' =&gt; $appId,
          'secret' =&gt; $appSecret,
      ));
      $fbuser = $facebook-&gt;getUser();
       $user_interest = $facebook-&gt;api('/me/movies');
  ?&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en-gb" lang="en-gb" &gt;&lt;head&gt;
  &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;title&gt;JS/Ajax Facebook Connect&lt;/title&gt;
   &lt;script&gt;
   function AjaxResponse()
   {
      var myData = 'connect=1'; 
       $.ajax({
      type: "POST",
      url: "process_facebook.php",
      data: myData
      }).done(function(result) {
      $("#fb-root").html(result);
      });
     }
  
  
   &lt;/script&gt;&lt;/head&gt;&lt;body&gt;
  
  &lt;div id="fb-root"&gt;&lt;/div&gt;
  &lt;script type="text/javascript"&gt;
  window.fbAsyncInit = function() {
  FB.init({
      appId: '&lt;?php echo $appId; ?&gt;',
      cookie: true,
      xfbml: true,
  //  channelUrl: '&lt;?php echo $return_url; ?&gt;channel.php',
      oauth: true});};
  document.write($user_interest);
  (function() {
      var e = document.createElement('script');
      e.async = true;
      e.src = document.location.protocol +'//connect.facebook.net/en_US/all.js';
      document.getElementById('fb-root').appendChild(e);}());
  
  function CallAfterLogin(){
          FB.login(function(response) {
          if (response.status === "connected")
          {
              LodingAnimate(); //Animate login
              FB.api('/me', function(data) {
              console.log($user_interest);
  
                }); 
           }     });  }
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>