title: Php webscraping using simple html dom not working when output is out of order html tags
body: <p>I want to scrap some information of a webpage .It uses a table layout structure.</p>
  
  <p>I want to extract the third table inside the nested table layout which contains a series of nested  tables .Each publishing a result .But the code is not working </p>
  
  <pre><code>include('simple_html_dom.php');
  $url = 'http://exams.keralauniversity.ac.in/Login/index.php?reslt=1';
  $html = file_get_contents($url);
  $result =$html-&gt;find("table", 2);
  echo $result;
  </code></pre>
  
  <p>I Used Curl to extract website but the problem is its tags is in out of order so it cannot be extracted using simple dom element .</p>
  
  <pre><code>    function curl($url) {
              $ch = curl_init();  // Initialising cURL
              curl_setopt($ch, CURLOPT_URL,$url);    // Setting cURL's URL option with the $url variable passed into the function
              curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // Setting cURL's option to return the webpage data
              $data = curl_exec($ch); // Executing the cURL request and assigning the returned data to the $data variable
              curl_close($ch);    // Closing cURL
              return $data;   // Returning the data from the function
          }
  
            function scrape_between($data, $start, $end){
          $data = stristr($data, $start); // Stripping all data from before $start
          $data = substr($data, strlen($start));  // Stripping $start
          $stop = stripos($data, $end);   // Getting the position of the $end of the data to scrape
          $data = substr($data, 0, $stop);    // Stripping all data from after and including the $end of the data to scrape
          return $data;   // Returning the scraped data from the function
      }
            $scraped_page  = curl($url);  // Executing our curl function to scrape the webpage http://www.example.com and return the results into the $scraped_website variable
  
             $scraped_data = scrape_between($scraped_page, ' &lt;/html&gt;', '&lt;/table&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
     &lt;/table&gt;');  
   echo $scraped_data;
   $myfile = fopen("newfile.html", "w") or die("Unable to open file!");
  
  fwrite($myfile, $scraped_data);
  fclose($myfile);
  </code></pre>
  
  <p>How to scrape the result and save the pdf </p>