title: How to display images when using cURL?
body: <p>When scraping page, I would like the images included with the text.</p>
  
  <p>Currently I'm only able to scrape the text. For example, as a test script, I scraped Google's homepage and it only displayed the text, no images(Google logo). </p>
  
  <p>I also created another test script using Redbox, with no success, same result.
  Here's my attempt at scraping the Redbox 'Find a Movie' page:</p>
  
  <pre><code>&lt;?php
  
  $url = 'http://www.redbox.com/Titles/AvailableTitles.aspx';
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL,$url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $result= curl_exec ($ch);
  curl_close ($ch);
  echo $result;
  
  ?&gt;
  </code></pre>
  
  <p>the page was broken, missing box art, missing scripts, etc. </p>
  
  <p>Looking at FF's Firebug's Extension 'Net' tool(allows me to check headers and file paths), I discovered that Redbox's images and css files were not loaded/missing (404 not found). I noticed why, it was because my browser was looking for Redbox's images and css files in the wrong place. </p>
  
  <p>Apperently the Redbox images and css files are located relative to the domain, likewise for Google's logo. So if my script above is using its domain as the base for the files path, how could I change this?</p>
  
  <p>I tried altering the host and referer request headers with the script below, and I've googled extensively, but no luck.</p>
  
  <p>My fix attempt:</p>
  
  <pre><code>&lt;?php
  
  $url = 'http://www.redbox.com/Titles/AvailableTitles.aspx';
  $referer = 'http://www.redbox.com/Titles/AvailableTitles.aspx';
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL,$url);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array("Host: www.redbox.com") );
  curl_setopt ($ch, CURLOPT_REFERER, $referer); 
  curl_setopt($ch, CURLOPT_NOBODY, false);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $result= curl_exec ($ch);
  curl_close ($ch);
  echo $result;
  
  ?&gt;
  </code></pre>
  
  <p>I hope I made sense, if not, let me know and I'll try to explain it better.
  Any help would be great! Thanks.</p>
  
  <p>UPDATE<br>
  <hr/>
  Thanks to everyone(especially Marc, and Wyatt), your answers helped me figure out a method to implement.<br>
  I was able to succesfully test by following the steps below:</p>
  
  <ol>
  <li>Download the page and its requisites via Wget.  </li>
  <li>Add <code>&lt;base href="..." /&gt;</code> to downloaded page's header.  </li>
  <li>Upload the revised downloaded page and its original requisites via <a href="http://wput.sourceforge.net/" rel="nofollow">Wput</a> to a temporary   server.  </li>
  <li>Test uploaded page on temporary server via browser  </li>
  <li>If the uploaded page is not displayed properly, some of the requisites might be missing still(css,jss,ect). View which are missing via a tool that lets you view header responses(eg. the 'net' tool from FF's Firebug Addon). After locating the missing requisites, visit original page that the uploaded page is based on, take note of proper requisite locations that were missing, then revise the downloaded page from step 1 to 
  accommodate the new proper locations and begin at step 3 again. Else, if page is rendered properly, then success!</li>
  </ol>
  
  <p>Note: When revising the downloaded page I manually edited the code, I'm sure you could use regEX or a parsing library on cUrl's request to automate the process.</p>