function index() { $header = new header(); $header->download("Download"); $content = file_get_contents("https://down.vn/"); preg_match_all('/<div id="content" class="clearfix">(.*?)<div class="clear">/s', $content, $matches, PREG_SET_ORDER); foreach ($matches as $key) { } $data['content'] = $key['1']; $this->load->view('file/index', $data); }
public static function download($file, $name = null) { // stop the download if the file does not exist or is not readable if (!is_file($file) or !is_readable($file)) { return false; } header::download(array('name' => $name ? $name : f::filename($file), 'size' => f::size($file), 'mime' => f::mime($file), 'modified' => f::modified($file))); die(f::read($file)); }
/** * Forces a download of the string as text file * * @param string $string * @param string $name Optional name for the downloaded file */ public static function download($string, $name = null) { header::download(array('name' => $name ? $name : 'text.txt', 'size' => static::length($string), 'mime' => 'text/plain')); die($string); }
function game($path) { $header = new header(); $mydb = $this->load->database('helihost', TRUE); $query = $mydb->select('*')->from('system_download')->like('path', $path)->get()->result_array(); if ($query) { $header->download("Download game " . $query[0]['name']); //$content=file_get_contents($query[0]['path']); redirect('http://myweb.pro.vn/download/index/'); } else { $header->download("Download game"); $content = file_get_contents('http://down.vn/game/' . $path); } //reset path //$content=str_replace('<a href="','<a href="/download',$content); //end preg_match_all('/<div id="content" class="clearfix">(.*?)<div class="clear">/s', $content, $matches, PREG_SET_ORDER); foreach ($matches as $key) { } //$content=str_replace('href="http://down.vn','href="http://myweb.pro.vn/game',$key['1']); //$content=str_replace('href="https://down.vn','href="http://myweb.pro.vn/game',$key['1']); $data['content'] = $content; $this->load->view('file/index', $data); }