PDA

View Full Version : [PHP] Request



TViYH
02-15-2008, 06:34 PM
I need something like a RuneScape Online Players grabber, but I need to grab the amount of posts a thread has on a certain forum...Any help?

Timer
02-15-2008, 06:51 PM
why php, just use a scar script?

ShowerThoughts
02-15-2008, 07:06 PM
yeah use srl, this function is special for it

StatsGrabberMAdeForelkins;

try it maybe... xD

Timer
02-15-2008, 07:21 PM
procedure StatsGrabberMadeForElkins;
var
PageContent: string;
begin
PageContent := GetPage('http://www..com');
PageContent := Between('somthing', 'sonthing', PageContent);
Writeln(PageContent);
end;

TViYH
02-15-2008, 07:30 PM
I want to echo it onto the page via HTML is why...
I'm not a good PHP scripter...I want a page that grabs a simple post number and echoes it...


EDIT: Timer, for between in SCAR, does it mean between the html code? or just the shown text.?

Timer
02-15-2008, 07:34 PM
between...
begin
Writeln(getpage('http://www..com');
end.

TViYH
02-15-2008, 07:42 PM
-.- You didn't answer my question. Does it retrieve what is between the visible text on that page, or between the HTML code inside it.

Timer
02-15-2008, 07:43 PM
idk, just run that, you'll see!! lol

TViYH
02-15-2008, 07:53 PM
Ok, so now I have it to where it retrieves the stuff...But now I need to make it into a website...

ShowerThoughts
02-15-2008, 08:56 PM
dude this SRL-FORUMS not CRAZY-ELKINS IDEA FORUMS

TViYH
02-15-2008, 09:06 PM
It's also a request forum. I don't admire your post.

Garrett
02-16-2008, 02:22 AM
Well.. I would help, but I don't exactly know what you need.


Ok, so now I have it to where it retrieves the stuff...But now I need to make it into a website...

So you need something like the echo(); command?
or just you need to know how to setup a webpage with php?

TViYH
02-16-2008, 05:33 AM
I need to know how to make PHP grab text between two words on a website, and echo them.

Garrett
02-16-2008, 06:12 AM
Ah.. ok, well I have a function for that already:


function str_between($str, $betw, $betw2)
{
$str = " " . $str;
$pos = strpos($str, $betw);
if ($pos > 0)
{
$str2 = substr($str, $pos + strlen($betw));
$pos2 = strpos($str2, $betw2);
if ($pos2 == 0)
return '';
return substr($str2, 0, $pos2);
}
else
{
return '';
}
}

TViYH
02-16-2008, 06:29 AM
Would this work then?:


<?php

function str_between($str, $betw, $betw2)
{
$str = " " . $str;
$pos = strpos($str, $betw);
if ($pos > 0)
{
$str2 = substr($str, $pos + strlen($betw));
$pos2 = strpos($str2, $betw2);
if ($pos2 == 0)
return '';
return substr($str2, 0, $pos2);
}
else
{
return '';
}
}

$users = str_between('http://srl-forums.com/forum/','<a href="online.php" rel="nofollow">','<a href="online.php" rel="nofollow">Currently Active Users</a>','</div></div>');
echo $users;

?>

Garrett
02-16-2008, 03:33 PM
That wouldn't... you have to do a file_get_contents to get a webpage.

I tested this, and it works:

<?php

function str_between($str, $betw, $betw2)
{
$str = " " . $str;
$pos = strpos($str, $betw);
if ($pos > 0)
{
$str2 = substr($str, $pos + strlen($betw));
$pos2 = strpos($str2, $betw2);
if ($pos2 == 0)
return '';
return substr($str2, 0, $pos2);
}
else
{
return '';
}
}

$site = file_get_contents('http://srl-forums.com/forum/');
$users = str_between($site, 'Currently Active Users</a>:', '
</td>');
echo $users;

?>

Harry
03-08-2008, 01:43 AM
Gravedig, sorry, my post is worth it ;)

Botmaster has a player grabber, check it out - is that what you mean?

Wizzup?
03-08-2008, 10:51 AM
He just wants to print the online players on a HTML page...
Not that hard in PHP. :)