title: Post automatically on the wall of user (facebook App)
body: <p>i want for my app to post on a user's wall on behalf (for advertising e.g.). I think about creating a php script, which i will execute with a cron job on my server every week.
  I have the userids in my database. 
  Now i want that the script gets an userid and then posts on the wall of the user. (of course if the user has got still installed the app and granted the publish stream permission)</p>
  
  <p>is it possible to create a script that triggers this?<br>
  $post = $facebook->api("/$user1/feed","POST",$params); or<br>
  $post = $facebook->api("/$user2/feed","POST",$params); etc...? </p>
  
  <p>Thank for advise</p>
  
  <pre><code>&lt;?php
  
  require 'src/facebook.php';
  $app_id = 'yourappid';
  $app_secret = 'yourappsecret';
  $app_namespace = 'appname';
  $app_url = 'https://apps.facebook.com/' . $app_namespace . '/';
  $scope = 'email,publish_actions';
  
  
  // Init the Facebook SDK
  $facebook = new Facebook(array(
   'appId'  =&gt; $app_id,
   'secret' =&gt; $app_secret,
  ));
  
  
  
  // Get the current user
  $user = $facebook-&gt;getUser();
  
  // If the user has not installed the app, redirect them to the Auth Dialog
  if (!$user) {
    $loginUrl = $facebook-&gt;getLoginUrl(array(
     'scope' =&gt; $scope,
     'redirect_uri' =&gt; $app_url,
   ));
  
    print('&lt;script&gt; top.location.href=\'' . $loginUrl . '\'&lt;/script&gt;');
  
     }
  
  
      else {
  
         try {
          $params = array(
              'message'       =&gt;  "your message",
              'name'          =&gt;  "hello world",
              'description'   =&gt;  "hello world",
              'link'          =&gt;  "hello world",
              'picture'       =&gt;  "hello world",
          );
  
          $post = $facebook-&gt;api("/$user/feed","POST",$params);
  
          echo "";
  
       }
        catch (FacebookApiException $e) {
         $result = $e-&gt;getResult();
       }
  
    }
  
   ?&gt;
  </code></pre>