note 70282 added to function.curl-exec

From: Date: Tue, 10 Oct 2006 09:34:17 +0000
Subject: note 70282 added to function.curl-exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-118333@lists.php.net to get a copy of this message
/* 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; } ---- Server IP: 83.137.200.2 Probable Submitter: 80.202.243.156 ---- Manual Page -- http://www.php.net/manual/en/function.curl-exec.php Edit -- https://master.php.net/note/edit/70282 Del: integrated -- https://master.php.net/note/delete/70282/integrated Del: useless -- https://master.php.net/note/delete/70282/useless Del: bad code -- https://master.php.net/note/delete/70282/bad+code Del: spam -- https://master.php.net/note/delete/70282/spam Del: non-english -- https://master.php.net/note/delete/70282/non-english Del: in docs -- https://master.php.net/note/delete/70282/in+docs Del: other reasons-- https://master.php.net/note/delete/70282 Reject -- https://master.php.net/note/reject/70282 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#118333) next »