title: PowerShell - HTML parsing: get information from a website
body: <p><em>Update, Script is working with PowerShell V3.0, Thanks @ Doug</em></p>
  
  <p>I want to use the following PowerShell script to get flight status information from Lufthansa.
  I can see flight status information in the browser, but I haven't found any way to access this information with my script.</p>
  
  <p>I want to get the following information from the website:</p>
  
  <ul>
  <li>flight status </li>
  <li>time (departure, arrival)  </li>
  <li>airport (departure, arrival)</li>
  <li>Flight Number (Only Lufthansa)</li>
  </ul>
  
  <p>Script:</p>
  
  <pre><code>$flight = " LH3396"
  $url = "http://bing.com?q=flight status for $flight"
  $result = Invoke-WebRequest $url
  $elements = $result.AllElements | Where Class -eq "ans" | Select -First 1 -ExpandProperty innerText 
  
  #[string[]]$resultArray
  
  $resultArray = @()
  
  foreach($element in $elements.Split("`n")){
      if($element.Length -gt "2")
      {$resultArray += $element}
  }
  </code></pre>