note 15701 added to function.fclose

From: Date: Thu, 27 Sep 2001 07:42:17 +0000
Subject: note 15701 added to function.fclose
Groups: php.notes 
Request: Send a blank email to php-notes+get-18359@lists.php.net to get a copy of this message
/* * File name: Your_File_name * Description: PHP Scripts which gets the data from the * Any website and we can perform regular expression funtions * on that data afterwards to get our desired data. * Author: Mohammad Asim Makki : densefunctions@hotmail.com * Web Developer PHP/JAVA * Nettech Limited --- Silcon Ways */ function getData($URL){ //Giving the String URL as argument it returns all webpage as a String to you $allPage = ""; if($URL == null){ //Checking provided URL echo("<b><font color=\"red\">Please specify a URL to get data from </font></b>"); } $fp= fopen($URL, r); //Opening Connection if ( !$fp ) { // Check connection echo("<b><font color=\"red\">Connection Failed</font></b>"); } else{ $num=0; while ( !feof($fp) ){ $pageText[$num] = fread($fp,1024);// read WebPage $num++; } //endwhile; } $arrayLen=count($pageText); for($i=0; $i<$arrayLen; $i++){ $allPage=$allPage.$pageText[$i]; } fclose($fp); return $allPage; } //===Example of usage of function=== echo(getData("http://www.msn.com/")); -- http://www.php.net/manual/en/function.fclose.php http://master.php.net/manage/user-notes.php?action=edit+15701 http://master.php.net/manage/user-notes.php?action=delete+15701 http://master.php.net/manage/user-notes.php?action=reject+15701

« previous php.notes (#18359) next »