download.php 362 B

123456789101112
  1. <?php
  2. $fp = fopen (__DIR__. '/test.html', 'w+');
  3. $ch = curl_init("http://127.0.0.1/index.php");
  4. curl_setopt($ch, CURLOPT_TIMEOUT, 50);
  5. curl_setopt($ch, CURLOPT_ENCODING, "gzip");
  6. // write curl response to file
  7. curl_setopt($ch, CURLOPT_FILE, $fp);
  8. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  9. // get curl response
  10. curl_exec($ch);
  11. curl_close($ch);
  12. fclose($fp);