title: file_get_contents from multiple url
body: <p>i want to save page content to files from multiple url.</p>
  
  <p>For start i have sites url from array</p>
  
  <pre><code>$site = array( 
          'url' =&gt; 'http://onesite.com/index.php?c='.$row['code0'].'&amp;o='.$row['code1'].'&amp;y='.$row['code2'].'&amp;a='.$row['cod3'].'&amp;sid=', 'selector' =&gt; 'table.tabel tr'
      );  
  </code></pre>
  
  <p>For saveving files I have try:</p>
  
  <pre><code>foreach($site  as $n) {
  $referer = 'reffername';
  
  
  $header[] = "Accept: text/xml,application/xml,application/json,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
  $header[] = "Cache-Control: max-age=0";
  $header[] = "Connection: keep-alive";
  $header[] = "Keep-Alive: 300";
  $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
  $header[] = "Accept-Language: en-us,en;q=0.5";
  
  $opts = array('http'=&gt;array('method'=&gt;"GET",
                              'header'=&gt;implode('\r\n',$header)."\r\n".
                              "Referer: $referer\r\n",
                              'user_agent'=&gt; "Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.0.2) Gecko/2008092313 Ubuntu/9.25 (jaunty) Firefox/3.8"));
  $context = stream_context_create($opts);
  
  $data = file_get_contents($site["url"], false, $context);
  
  $file = md5('$id');
  
  file_put_contents($file, $data);
  $content = unserialize(file_get_contents($file));
  }
  </code></pre>