title: Graph API Facebook timeout
body: <p>I have Facebook pages which I need to extract sum data every day(like,post,shar...), but I run my script hi got data for 2 or 3 page Facebook max and hi stoped with sum error</p>
  
  <p>my script</p>
  
  <pre><code>include '../webroot/fb/facebook.php';
          //Get Facebook SDK Object
          $config = array(
                  'appId'  =&gt; 'codeapl',
                  'secret' =&gt; 'secret',
                  'cookie' =&gt; true);
          $facebook = new Facebook($config);
          $this-&gt;Pag-&gt;recursive = -1;
          $pages=$this-&gt;Pag-&gt;find('all');
          foreach ($pages as $page)
          {
              //Info page
              $this-&gt;Pag-&gt;id=$page['Pag']['id'];
              $params = array('method' =&gt; 'fql.query',
                  'query' =&gt;  "SELECT pic FROM page WHERE page_id='".$page['Pag']['idpage']."'",);
              $result = $facebook-&gt;api($params);
              $this-&gt;request-&gt;data['Pag']['image']= $result[0]['pic'];
              $this-&gt;Pag-&gt;save($this-&gt;request-&gt;data);
  
              //Statistique
              $page_id=$page['Pag']['id'];
              $idpage=$page['Pag']['idpage'];
              $params = array('method' =&gt; 'fql.query',
                  'query' =&gt;  "SELECT fan_count,talking_about_count,pic FROM page WHERE page_id='$idpage'",);
  
              $result = $facebook-&gt;api($params);
              $this-&gt;loadModel('Statistique');
              $this-&gt;Statistique-&gt;create();
              $this-&gt;request-&gt;data['Statistique']['likes']= $result[0]['fan_count'];
              $this-&gt;request-&gt;data['Statistique']['talk']= $result[0]['talking_about_count'];
              $this-&gt;request-&gt;data['Statistique']['pag_id']= $page_id;
  
              $params = array('method' =&gt; 'fql.query',
                  'query' =&gt; "select message,share_count,comments,likes from stream where source_id='$idpage' and is_published=1 limit 1000");
              $result = $facebook-&gt;api($params);
              $message=0;
              $comment=0;
              $shar=0;
              $like=0;
              foreach ($result as $value) 
              {
                  $message++;
                  $shar=$shar+$value['share_count'];
                  if(isset ($value['likes']['count']))
                      $like=$like+$value['likes']['count'];
                  $comment=$comment+$value['comments']['count'];
              }
  
              $this-&gt;request-&gt;data['Statistique']['posts']=$message;
              $this-&gt;request-&gt;data['Statistique']['likepost']=$like;
              $this-&gt;request-&gt;data['Statistique']['comments']=$comment;
              $this-&gt;request-&gt;data['Statistique']['char']=$shar;
              $this-&gt;Statistique-&gt;save($this-&gt;request-&gt;data);
  
  
              //pays
              $params = array('method' =&gt; 'fql.query',
                  'query' =&gt;  "SELECT value FROM insights WHERE
                      object_id='$idpage' AND metric='page_fans_country'
                      AND end_time=end_time_date('2013-04-14T07:00:00+0000') AND period=period('lifetime')",);
              $result = $facebook-&gt;api($params);
              $this-&gt;loadModel('Payspage');
              foreach ($result[0]['value'] as $key =&gt; $value)
              {
                  $pays_id=$this-&gt;requestAction("/pays/setpays/$key");
                  $this-&gt;Payspage-&gt;create();
                  $data['Payspage']['pay_id']=$pays_id;
                  $data['Payspage']['pag_id']=$page_id;
                  $data['Payspage']['nombre']=$value;
                  $this-&gt;Payspage-&gt;save($data);
              }
          }
  </code></pre>
  
  <p>the error is</p>
  
  <pre><code>Error: Maximum execution time of 60 seconds exceeded    
  File: C:\wamp\www\pub\app\webroot\fb\base_facebook.php  
  Line: 971
  </code></pre>