title: downloading a page without downloading image files or css or javascript with curl
body: <p>Whenever i use <code>curl(php)</code> to download a page it downloads everything on the page like <code>images, css files or javascript files</code>. but sometimes i dont want to download these. can i control the resources that i download through curl. i have gone through the manual but i havent found an option that can make this happen? Please dont suggest getting the whole page and then using some <code>regex</code> magic because that would still download the page and increase load time.
  this is a demo code where i download a page from <code>mozilla.com</code></p>
  
  <pre><code>&lt;?php
  $url="http://www.mozilla.com/en-US/firefox/new/";
  $userAgent="Mozilla/5.0 (Windows NT 5.1; rv:2.0)Gecko/20100101 Firefox/4.0";
  //$accept="text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
  $encoding="gzip, deflate";
  $header['lang']="en-us,en;q=0.5";
  $header['charset']="ISO-8859-1,utf-8;q=0.7,*;q=0.7";
  $header['conn']="keep-alive";
  $header['keep-alive']=115;
  
  $ch=curl_init();
  curl_setopt($ch,CURLOPT_USERAGENT,$userAgent);
  curl_setopt($ch,CURLOPT_URL,$url);
  curl_setopt($ch,CURLOPT_ENCODING,$encoding);
  curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
  curl_setopt($ch,CURLOPT_AUTOREFERER,1);
  $content=curl_exec($ch);
  curl_close($ch);
  echo $content;
  ?&gt;
  </code></pre>
  
  <p>when i echo the content it shows the images too. i saw in <code>firebug's network tab</code> that images and <code>external js</code> files are being downloaded</p>