I want to grab first 10 results of that any url i passed it to function as parameter ..and i want to make data scraper for some sites
Getting Syntax error when I print the result on screen syntax error on this line I don't why it giving me syntax error kindly help me....
print_r( $dse->crawl()->parse() );
<?php               
      class CURL_CRAWLER{
      public $url;
      public $request_type;
      public $data;
      public $post_params;
  function __construct($url = '' , $request_type = 'GET')
  {
     $this->url = $url;
     $this->request_type = $request_type;
     $this->data = '';
     $this->post_params = array();
   }
/**crawl a document **/
 function crawl()
   {
    $curl = curl_init( $this->url );
    curl_setopt($curl, CURLOPT_HEADER, false);
    curl_setopt($curl, CURLOPT_TIMEOUT, 60);
    curl_setopt($curl, CURLOPT_USERAGENT, 'cURL PHP');
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
    $this->data = curl_exec($curl);
    curl_close($curl);
    return $this; //make it a chainable method
   }
/** Parse result data **/
   function parse(){
   $result = array();
   $count = 0;
   $dom = new DOMDocument;
   $dom->preserveWhiteSpace = false;
   $dom->loadHTML($this->data);
   $xpath = new DOMXPath($dom);
   $news = $xpath->query('//td[@bgcolor="#DDDDDD"]/table/tr[position()=2]/td[position()=2]');
   foreach( $news as $n){
       $result[] =   $n->nodeValue;
       $count++;
       if ($count >9)
           break; //we just need  10 results. Index starts from 0
   }
   return $result;
      }
    }
 error_reporting(0);
        $dse = new CURL_CRAWLER('http://www.dsebd.org/display_news.php');
    echo "<pre>";
    print_r( $dse->crawl()->parse() );
    echo "<pre>";
   ?>
    
<?phpbeforeprint_r->to->inprint_rargument