title: Invite friends to event facebook api
body: <p>My script is pretty slow when inviting users to event, because it has to check if user already is invited to the event, or else it will give a facebook ouath error.</p>
  
  <p>Can i make it faster?</p>
  
  <pre><code>foreach ( $_POST['friends'] as $ids ) {
      if ( $i &lt; 199 ) {
          $iZ = $facebook-&gt;api("/".$event_id."/invited/".$ids, "GET");
              if ( $iZ['data'][0]['rsvp_status']):
                      $status = $iZ['data'][0]['rsvp_status'];
              else:
                      $status="";
              endif;
  
      if ( ($status != 'declined' &amp;&amp; $status != 'attending' &amp;&amp; $status != "unsure" &amp;&amp; $status !=     "not_replied") || empty($status)) {
              $id.=$ids . ",";
              $i=$i+1;
      }
   }
  }
  
  $id = substr_replace($id ,"",-1);
  
  
  echo $facebook-&gt;api("/".$event_id . "/invited",'POST', array("users" =&gt; $id));
  </code></pre>