This is a discussion on Anyway to see if a url 'consists' something? within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Lets say I set a variable, $lines = file ('http://tibia.4players.de/statistics/?subtopic=whoisonline&world=Nova'); $charname = $_POST['...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Lets say I set a variable,
$lines = file ('http://tibia.4players.de/statistics/?subtopic=whoisonline&world=Nova'); $charname = $_POST['charname']; if($lines (?consists?) $charname) { echo "<font color='green'>". $charname ."</font>"; } Is it possible to see if this homepage consists lets say a Character Name like in this case? I am making an online list for my guild's homepage... and I want to see if someone is online then his/her name should be shown in Green for e.g If it is, how do I write the script? Please help me!!! =( In advance, Andreas Saarva. |
|
|||
|
On Thu, 26 Feb 2004 12:59:36 +0100, "Andreas Saarva"
<andreas_saarva@hotmail.com> wrote: >Lets say I set a variable, > >$lines = file >('http://tibia.4players.de/statistics/?subtopic=whoisonline&world=Nova'); > >$charname = $_POST['charname']; > >if($lines (?consists?) $charname) { > echo "<font color='green'>". $charname ."</font>"; >} > > >Is it possible to see if this homepage consists lets say a Character Name >like in this case? > >I am making an online list for my guild's homepage... and I want to see if >someone is online then his/her name should be shown in Green for e.g > >If it is, how do I write the script? > >Please help me!!! =( > >In advance, >Andreas Saarva. I think you are looking for something like this: for ($i=0; $i<count($lines);$i++) { if (stristr ($lines[$i], $charname)) { str_replace ($charname, "<span style="color: green;">$charname</span>); } echo $lines[$i]; } Case of name may be a problem, so you may want to use eregi_replce instead. (BTW, <font> is deprecated. ;-) ) |