(Answer) (Category) Products of Aardvarks With Chisels : (Category) HTML : (Category) PHP stuff :
snake.php
Replace all occurences of one word with another. Spurred by a converstaion wherin someone thought that a document mentioned deadly sinks when it was actually talking about deadly snakes. Ask Ben.
http://www.teleologic.net/danny/demos/snake.php
http://www.teleologic.net/danny/demos/snake.phps
<?
        if($URL){
                // protect against people leaving off http:// (unless host starts with h)
                $URL = $URL[0]=="h" ? $URL : "http://$URL";
                $fd = fopen($URL, "r") or die("Can't open $URL");
                $contents = "";
                while(!feof($fd)){
                        $contents .= fread($fd, 1024);
                }
                print str_replace(ucfirst($OLDWORD), ucfirst($NEWWORD),
                        str_replace($OLDWORD, $NEWWORD, $contents));
                exit;
        }
?>
<HTML>
<HEAD><TITLE>word translator</TITLE></HEAD>
<BODY>
<FORM METHOD="POST">
<TABLE>
<TR>
<TD>URL:</TD>
<TD COLSPAN="3"><INPUT TYPE="TEXT" NAME="URL" SIZE="50"></TD>
</TR>
<TR>
<TD>oldword:</TD>
<TD><INPUT TYPE="OLDWORD" NAME="OLDWORD" SIZE="20" VALUE="snake"></TD>
<TD>newword:</TD>
<TD><INPUT TYPE="NEWWORD" NAME="NEWWORD" SIZE="20" VALUE="sink"></TD>
</TR>
<TR>
<TD COLSPAN="4" ALIGN="RIGHT"><INPUT TYPE="SUBMIT"></TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
[Append to This Answer]
2001-Nov-26 3:27pm
Previous: (Category) Discussions
Next: (Answer) triangle.php
This document is: http://www.cloudmaster.com/~sauer/projects/index.cgi?file=116
[Search] [Appearance]
This is a Faq-O-Matic 2.719.
This FAQ administered by sauer@cloudmaster.com