Re: Read after parsing

From: Date: Thu, 24 Apr 2003 22:01:08 +0000
Subject: Re: Read after parsing
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-145197@lists.php.net to get a copy of this message
I changed how I'm reading the files and now getting this error: Warning: file("http://www.d2sector.net/footer.php") - Bad file descriptor in /home/.sites/28/site1/web/adcheck/dodb.php on line 95 Warning: Invalid argument supplied for foreach() in /home/.sites/28/site1/web/adcheck/dodb.php on line 97 In file footer.php, I DID NOT find the code! But it works in some files... Here's my new code: foreach($realfiles as $name) { $content = file($site['address'].$name); $thestuff = ''; foreach($content as $line) { $thestuff .= $line; } if(strstr($thestuff, $site['code'])) { echo "In file ".$name.", I found the required code!<br>"; } else { echo "<font color=\"red\">In file <a href='javascript:void(0)' onclick=\"javascript:window.open('".$site['address'].$name."','fileview','scrollbars,resizable');\">$name</a>, I <B>DID NOT</B> find the code!</font><br>"; } } Thanks, Stephen Craton http://www.melchior.us ----- Original Message ----- From: "Stephen" <webmaster@melchior.us> To: <holmes072000@charter.net> Cc: "PHP List" <php-general@lists.php.net> Sent: Thursday, April 24, 2003 4:08 PM Subject: Re: [PHP] Read after parsing Ok, I did this along with the filename after the domain like /admin.php or whatever but it didn't work. It works for some files but not others. Here's my code: foreach($realfiles as $name) { $fp = fopen($site['address'].$name, "r"); $content = fread($fp, filesize($site['relative'].$name)); if($content == '') { echo "<font color=\"blue\">In file $name, I <i>DID NOT</i> find the code but it was an empty file (probably a php include containing functions and stuff)</font><br>"; } if(strstr($content, $site['code'])) { echo "In file ".$name.", I found the required code!<br>"; } else { echo "<font color=\"red\">In file <a href='javascript:void(0)' onclick=\"javascript:window.open('".$site['address'].$name."','fileview','scrollbars,resizable');\">$name</a>, I <B>DID NOT</B> find the code!</font><br>"; } } And here's what it outputs (just a sample of the stuff): Warning: fopen("http://www.d2sector.net/auth.php","r") - Bad file descriptor in /home/.sites/28/site1/web/adcheck/dodb.php on line 96 Warning: Supplied argument is not a valid File-Handle resource in /home/.sites/28/site1/web/adcheck/dodb.php on line 97 In file auth.php, I DID NOT find the code but it was an empty file (probably a php include containing functions and stuff) In file auth.php, I DID NOT find the code! In file backend.php, I DID NOT find the code! In file banners.php, I DID NOT find the code! Warning: fopen("http://www.d2sector.net/config.php","r") - Bad file descriptor in /home/.sites/28/site1/web/adcheck/dodb.php on line 96 Warning: Supplied argument is not a valid File-Handle resource in /home/.sites/28/site1/web/adcheck/dodb.php on line 97 In file config.php, I DID NOT find the code but it was an empty file (probably a php include containing functions and stuff) In file config.php, I DID NOT find the code! Warning: fopen("http://www.d2sector.net/footer.php","r") - Bad file descriptor in /home/.sites/28/site1/web/adcheck/dodb.php on line 96 Warning: Supplied argument is not a valid File-Handle resource in /home/.sites/28/site1/web/adcheck/dodb.php on line 97 In file footer.php, I DID NOT find the code but it was an empty file (probably a php include containing functions and stuff) In file footer.php, I DID NOT find the code! Please help! Thanks, Stephen Craton http://www.melchior.us ----- Original Message ----- From: "John W. Holmes" <holmes072000@charter.net> To: "'Stephen'" <webmaster@melchior.us>; "'PHP List'" <php-general@lists.php.net> Sent: Wednesday, April 23, 2003 8:27 PM Subject: RE: [PHP] Read after parsing > What is the function to read a file after it's been parsed by the server? > I was using fread but since I'm searching for a certain HTML code and > since some sites I'm searching use templated content managment system > (i.e. phpNuke), I need to view it after it's been parsed. There's no function, you just need to open it up through HTTP, just like a regular request... $fp = fopen('http://www.domain.com','r'); ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

« previous php.general (#145197) next »