title: Using FQL to get comments from a webpage, LIMIT and OFFSET, but result fail when there are more than 900 comments
body: <p>I'm running a contest where I count up all the daily comments on a webpage per unique commenter each day.  At the end of the month, the person with the most comment-votes wins.  I have logic written for this that worked perfectly ... until today.</p>
  
  <p>When a page has more than 900 or so comments, the vote-counter stops going up.  I figured this had to do with pagination, so I altered my FQL query to use LIMIT and OFFSET to parse 100 comments at a time and combine the results for my vote-counting function, but when running my queries (even by hand, putting the <a href="https://graph.facebook.com/comments" rel="nofollow">https://graph.facebook.com/comments</a> url in the address bar) it craps out somewhere between 500 and 600 comments, so the last 400 or so comments on the webpage never even return!</p>
  
  <p>Since this method is failing is there a more reliable way to get the comment data?</p>
  
  <p>UPDATE:  I'm supplying some code, but I've found the same problems persist in FQL as in the Graph API.  Here's my graph API call:</p>
  
  <pre><code>https://graph.facebook.com/comments/?ids=http://www.burlesquebitch.com/article.php?id=538&amp;limit=500
  </code></pre>
  
  <p>If you crank the limit to over ~600 where more than 900 comments exist (or add an offset that would put the results past that range) it begins to fail.  The earlier comments disappear.  When I count up the results they're somewhere between 500-600.</p>
  
  <pre><code>    https://graph.facebook.com/comments/?ids=http://www.burlesquebitch.com/article.php?id=538&amp;limit=1000
  </code></pre>
  
  <p>Then I finally got fql working:</p>
  
  <pre><code>$fql_query_result =  file_get_contents("https://graph.facebook.com/fql?q=SELECT+object_id,+id,+text,+time+,+fromid+FROM+comment+WHERE+object_id='366760226746431'+LIMIT+1000");
  $data = json_decode($fql_query_result,true);
  </code></pre>
  
  <p>It also fails, but more like around 800-900.  In any case the bad behavior is the same.  I even did some experiments where I limited the query by time hoping that by isolated my results to a date range I would keep myself within it's failing threshold:</p>
  
  <pre><code>$fql_query_result =  file_get_contents("https://graph.facebook.com/fql?q=SELECT+object_id,+id,+text,+time,+fromid+FROM+comment+WHERE+object_id='366760226746431'+AND+time&gt;1365984000+AND+time&lt;1366416000+LIMIT+500");
  $data = json_decode($fql_query_result,true);
  </code></pre>
  
  <p>But no dice.  If I flip the &lt; to > in my time comparison the entire query fails and returns nothing.  Idealy I would want to get the paging information, as suggested in the answer below, but I can't SELECT it in my query... if I try and get anything that ends in _cursor the query returns empty.</p>
  
  <p>I am forced to conclude that whatever horrendous bug lives in the Graph API code its extended into the FQL code as well.  I know of no other way to get data from a facebook object this size.</p>