title: Facebook User's permission when using an Application on own website - integrate in PHP rather than Url
body: <p>I created a Facebook App using PHP on my website. To use this application on my website the user must login using Facebook authentication.</p>
  
  <p>This app basically lets the user post a default comment on his wall. It works fine using my facebook profile account, but when I asked my friend to use my site he gets the following error - 'Uncaught OAuthException: (#200) The user hasn't authorized the application to perform this action thrown in'</p>
  
  <p>The only solution to my problem i found till now is by entering the following URL - <code>&lt;pre&gt;https://www.facebook.com/login.php?api_key=API_KEY&amp;cancel_url=http://www.magimagi.com&amp;next=http://magimagi.com/login/uploadtopage2.php&amp;fbconnect=1&amp;return_session=1&amp;session_version=3&amp;v=1.0&amp;display=page&amp;req_perms=user_about_me,user_birthday,publish_stream,offline_access&lt;/pre&gt;</code></p>
  
  <p>I do not want to create a link on my app for the user to click it - instead I want it integrated into the PHP code already on my website.</p>
  
  <p>Here is a sample PHP code I have</p>
  
  <pre><code>&lt;pre&gt;
  
  / Get User ID
  $user = $facebook-&gt;getUser();
  
  if ($user) {
    try {
      $user_profile = $facebook-&gt;api('/me');
    } catch (FacebookApiException $e) {
      error_log($e);
      $user = null;
    }
  }
  if ($user) {
    $logoutUrl = $facebook-&gt;getLogoutUrl();
  } else {
    $loginUrl = $facebook-&gt;getLoginUrl(   array(
         'scope' =&gt; 'publish_stream'
        ));
  }
  &lt;/pre&gt;
  </code></pre>
  
  <p>This is the HTML</p>
  
  <pre><code>&lt;pre&gt;
  &lt;form id="selectFriend" name="selectFriend" method="post"&gt;
  &lt;label for="Friend"&gt;Friend:&lt;/label&gt;
  &lt;select id="friend" name="friend"&gt;
  &lt;?php 
  foreach($user_friends['data'] as $f){
  echo '&lt;option value="'.$f['id'].'"&gt;'.$f['name'] .'&lt;/option&gt;';
  } 
  ?&gt;
  &lt;/select&gt;
  &lt;label for="URL"&gt;URL:&lt;/label&gt;
  &lt;input id="link" name="link"&gt;
  &lt;input id="message" name="message"&gt;
  &lt;input type="submit" name="submit" id="submit" value="Send!"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p></p>