title: HTML Parsing by PHP
body: <p>I am trying to parse the tender information (Department, location, Ref No, Closing Date, Description and the Urls (for attachment/downloadable pdf) for tender files) in an array from the following site
  <a href="http://www.biman-airlines.com/corporate/tender" rel="nofollow noreferrer">http://www.biman-airlines.com/corporate/tender</a></p>
  
  <p>i am a newbie and dont know how to do it. i tried the following which is not working</p>
  
  <pre><code>&lt;?php
  $url = "http://www.biman-airlines.com/corporate/tender";
  $ch = curl_init();
  $timeout = 5;
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
  $html = curl_exec($ch);
  curl_close($ch);
  
  $dom = new DOMDocument();
  
  @$dom-&gt;loadHTML($html);
  
  $xpath = new DomXPath($dom);
  
  
  $headerNames = array();
  foreach ($xpath-&gt;query('//table[@id=""]//th') as $node) {
  $headerNames[] = $node-&gt;nodeValue;
  }
  
  
  $data = array();
  foreach ($xpath-&gt;query('//tbody[@id=""]//tr') as $node) {
  $rowData = array();
  foreach ($xpath-&gt;query('td', $node) as $cell) {
      $rowData[] = $cell-&gt;nodeValue;
  }
  
  $data[] = array_combine($headerNames, $rowData);
  }
  
  print_r($data);
  ?&gt;
  </code></pre>