Anyway to see if a url 'consists' something?

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['...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-26-2004
Andreas Saarva
 
Posts: n/a
Default Anyway to see if a url 'consists' something?

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.


Reply With Quote
  #2 (permalink)  
Old 02-26-2004
Tyrone Slothrop
 
Posts: n/a
Default Re: Anyway to see if a url 'consists' something?

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. ;-) )

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:07 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0