title: file_get_contents() with modified HTTP headers returning garbage html output
body: <p>The following code is being used to extract html using SIMPLETHTMLDOM parser for php.</p>
  
  <pre><code>include('simple_html_dom.php');
  
  $context = stream_context_create(array(
    'http'=&gt;array(
      'method'=&gt;"GET",                
      'header'=&gt;"Accept: text/html,application/xhtml+xml,application/xml\r\n" .
                "Accept-Charset: ISO-8859-1,utf-8\r\n" .
                "Accept-Encoding: gzip,deflate,sdch\r\n" .
                "Accept-Language: en-US,en;q=0.8\r\n",
      'user_agent'=&gt;"User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.66 Safari/535.11\r\n"              
   )
  )); 
  
  $html = file_get_contents('http://www.nseindia.com/content/equities/cmbhav.htm', false, $context);
  echo $html;
  
  foreach($html-&gt;find('a') as $e) 
      echo $e-&gt;href . '&lt;br&gt;';
  </code></pre>
  
  <p><strong>The output generated is Garbage html :</strong></p>
  
  <pre><code>‹µVßsâ6~Ï_¡s§¹ð2¹^:ìNˆÝ†)!ið=äéFØV"K&gt;I˜pMÿ÷®lCšéÝKy@+í­¾ý´òè]t}‘ÜÝÄä2¹š’›Oãéä‚x]J'qò¥Q5š=ŸÒxæ…G£ÜÂ À2,·ÂÙ&lt;&amp;]YsËÁ 8eŒ%ãœU©*·#ÚØ¦“Ù$×°&lt;* ôRc&lt;¢AóänÏ/ã8!v[B`áÑRÔâ&amp;Õ¼´D0¹Z³Þ=«X³è£SuohªŠBÉåZ¦¦wo¼pD“o*¦ 7“88ÉTº.@Ú¢ókà[ålþÓ­`[ÐæÀà,8yö_¸Pãí$ëŸHVñ³J÷XYÎXAð~Ö¤¬„÷ƒXŠÜ³óôTg/ "Wª×'ñÓSmÖgm‡€åJ’œÉL@¬µÒ'ò—»Ö’X½†áßdÃe¦6=%ÁéIðÒzH0«¸ÂìÍIgxô@&gt;W¾|°´xäÃBÐ–5ãëèŽ,V©JÞËúççU0½â2ð‰Uå^n„ø*·¨j¦žÙ&lt;ð±¾¯ˆt˜zùº.GxöjjìV AÅ _pÁívó,9$¥2H[%la”X[":zÐ/‡¤Ù´‘¿v5xô‡uªnÄ,}G6Ì3IÎÇÓ˜¤ „)YÊå ³](FÁ-—,Ëšåö4}ßÿ­Æ¿wÝî! 3V‘1²rn™¶†\‚†nõÿuÂ£æœ?ºÔí0p,³aQ{¡¤Åz“s ì_ÛÚ¬$8ó}R1ÁW2Àsï{O§7çQ4™ýŽ§t³ùÍùE3_ßFñ-.7ÕúøËi‹h°?øná£+%î…¬@ðdðáÅ^$Ì˜Àx3—&amp;±¶ä˜‰ÃŸ¡óB‡ÇraÊaó&amp;m§ÉU%¶Ž6//¼Ä™s Ç+;$;+l 5Ú6†Âg.­VÙº¾PÎ9Üõ¸ïô/,—U»^1ý–Lp®æ·²ËÁ{3    ¤;:Z•±ms€6RâVÈ&gt;ÈaÓ­ñp˜à ¶BTs,¹uu‹Úzôý±M¢FñªÀKÄ¤ÅÞ]]ÐáAgÇíMèöiö*[ûN×Ç]±ÚJì@Î¹ÁfÈS&amp;hüç§I2‰çôÔïŸÒ«ó[šþÏ8ºù_|$ªÞW^zï¶Ö@Â&amp;ŒÔF Å2²ä—Hƒ¬CdD?ÿ‡\²ÅòÛ¹ ÑA.Ïø¤xÏ@¿Iè£7)à`pi¢¬Ét‰ÖÐæÄæ°gk0jB&lt;=óšé4çºês&gt;¿Ð.]Â¤Âhš ­›\jvìÒ¦æ”S8&gt;Ñºï9‰V÷±W åu»ixH-[à—º¸ÇÀÍ‡Å?§m2“
  </code></pre>
  
  <p>Where am i doing Wrong !! I checked the headers info from fiddler. These are the actual header information when the link is opened with browser !!</p>
  
  <pre><code>[Client]
  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
  Accept-Encoding: gzip,deflate,sdch
  Accept-Language: en-US,en;q=0.8
  User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.66 Safari/535.11
  [Transport]
  Host: www.nseindia.com
  Proxy-Connection: keep-alive
  </code></pre>