PHP - What Is Init?
I have this line of code in a function but I can't figure out what its doing.
$this->Component->init($this); when I print_r($this->Component); i get Component Object ( [__controllerVars] => Array ( [plugin] => [name] => [base] => ) [_loaded] => Array ( ) [_primary] => Array ( ) [__settings] => Array ( ) [_log] => ) There is no init method or object in the Component Object as you can see, so I am lost. Any ideas? Thanks Similar Tutorialsgo on with the title, i mean, when i click the download button and it starts downloading, i can't refresh the page or go to other adress of my site, it will really take a long time. the header information is something like this (except some judgement) header("Content-Disposition: attachment; filename=" . $name); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Description: File Transfer"); header("Content-Length: " . filesize($adress)); flush(); // this doesn't really matter. $fp = fopen($adress, "r"); while (!feof($fp)) { echo fread($fp, 65536); flush(); // this is essential for large downloads } fclose($fp); it takes me days but i cant find any way...thanks a lot!!! thanks a lot!!! thanks a lot!!! Code: [Select] <html> <head> <title>Testing</title> </head> <body> <?php $config = parse_ini_file("config.ini",1); $email = $config['Email']; $host = $config['Host']; print_r ($host); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $host); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $contents = curl_exec ($ch); $fp = fopen($host.'.txt','w+'); $fw = fwrite($fp, $contents); curl_close ($ch); fclose($fp); ?> </body> </html> Ok, I am having a problem here. I have an automation script I am trying to make, but I hit a road block. I need to open up multiple URL's from using an array of URL's stored in my config.ini file. It looks like this: Code: [Select] Config.ini Host[] = www.websitea.com Host[] = www.websiteb.com Host[] = www.websitec.com Host[] = www.websited.com I want to use curl_setopt to open up each one of the urls stored in $host. If I use... Code: [Select] print_r ($host); ...I get this output: Code: [Select] Array ( [0] => www.websitea.com [1] => www.websiteb.com [2] => www.websitec.com [3] => www.websited.com ) Now, I need to take those websites in the array and open each one of them using curl_unit. I tried doing this... Code: [Select] curl_setopt($ch, CURLOPT_URL, $host); Then Code: [Select] $fp = fopen($host.'.txt','w+'); But I knew that wouldnt work. Basically, I need to open up all of the pages listed in the .ini file and save the HTML Content of those pages to their own text file, that's named after the URL. I figured I could open an array of URLS from my INI and write each one to their own text file. Example: websitea.com.txt (HTML Content from www.websitea.com) websiteb.com.txt (HTML Content from www.websiteb.com) websitec.com.txt (HTML Content from www.websitec.com) websited.com.txt (HTML Content from www.websited.com) |