note 70282 deleted from function.curl-exec by bjori

From: Date: Tue, 10 Oct 2006 12:26:34 +0000
Subject: note 70282 deleted from function.curl-exec by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-118343@lists.php.net to get a copy of this message
Note Submitter: http://www.havarnielsen.com Reason: useless ---- /* If you want to use parts of or an entire external page in your site, you can use this function to fetch it using either curl or fopen. The output buffer functions used in the curl section enables you to strip or format parts of the page before it is printed to the browserwindow. // usage (for curl): $data = open_external_url("http://www.php.net"); // (for fopen): $data = open_external_url("http://www.php.net", "fopen"); // use strpos, stristr, ereg_replace or any other string manipulation functions to strip <body> or <html> or other elements. echo $data; */ function open_external_url($url, $method = "curl") { $data = ''; if(strtolower($method) == "curl") { $ch = curl_init($filename); ob_start(); curl_exec($ch); curl_close($ch); $data = ob_get_contents(); ob_end_clean(); } else if(strtolower($method) == "fopen") { $file = fopen($url, "r"); while(!feof($file)) { //read file line by line into variable $data = $data . fgets($file, 4096); } fclose ($file); } return $data; }

« previous php.notes (#118343) next »