title: LIMITING extracted rows from Web Crawler
body: <p>So, i have this awesome web crawler code. it gets requested data from the mentioned site and pastes along with link associated with it. (Good Boy)</p>
  
  <p>Now the problem is, how to limit the extracted data to say 5 rows.
  I tried putting "LIMIT 5" (which we usually do in php sql queries) but it didn't work.. </p>
  
  <p>My code goes as follows::</p>
  
  <pre><code>&lt;div class="news-entry"&gt;
              &lt;div class="newsblock"&gt;
                  &lt;div style="clear:both"&gt;&lt;/div&gt;
                      &lt;h2&gt;
                         &lt;a rel="nofollow" target="_blank" href="http://www.usmle-forums.com/usmle-step-3-forum/"&gt;
                              USMLE-Forums :: STEP-3         
                         &lt;/a&gt;
                      &lt;/h2&gt;
                  &lt;ul&gt;
                      &lt;?php
                          function get_datafour($url) {
                          $ch = curl_init();
                          curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
                          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                          curl_setopt($ch, CURLOPT_URL,$url);
                          $result=curl_exec($ch);
                          curl_close($ch);
                          return $result;
                          }
                          $returned_content = get_datafour('http://www.usmle-forums.com/usmle-step-3-forum/');
                          $first_step = explode( '&lt;tbody id="threadbits_forum_30"&gt;' , $returned_content );
                          $second_step = explode('&lt;/tbody&gt;', $first_step[1]);
                          $third_step = explode('&lt;tr&gt;', $second_step[0]);
                          // print_r($third_step);
                          foreach ($third_step as $element) {
                          $child_first = explode( '&lt;td class="alt1"' , $element );
                          $child_second = explode( '&lt;/td&gt;' , $child_first[1] );
                          $child_third = explode( '&lt;a href=' , $child_second[0] );
                          $child_fourth = explode( '&lt;/a&gt;' , $child_third[1] );
                          $final = "&lt;a href=".$child_fourth[0]."&lt;/a&gt;&lt;/br&gt;";
                      ?&gt;
                      &lt;li target="_blank" class="itemtitle"&gt;
                          &lt;span class="item_new"&gt;&lt;/span&gt;&lt;?php echo $final?&gt;
                      &lt;/li&gt;
                      &lt;?php
                          }
                      ?&gt;      
                  &lt;/ul&gt;        
                  &lt;div style="clear:both"&gt;&lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>Any Suggestions are Appreciated..</p>