Jump to content

preg_match


Baving

Recommended Posts

I am not getting it from a database, I am getting the file contents from another site and then exploding the div tag to retrieve the content.

 

Code: -

if(@$_GET['do']=='getcount') {
$ext = @$_GET['ext'];

$file = file_get_contents("http://sitehere".$ext);

$explode = explode("<td id=\"topbar-count\">",$file,2);
$explode2 = explode("</td>", $explode[1],2);
$count = $explode2[0];
echo $count;
}

 

I need the preg_match somewhere in there to remove the members online and only show the number.

Link to comment
https://forums.phpfreaks.com/topic/54584-preg_match/#findComment-269907
Share on other sites

Oh, I'm sorry...I read the question wrong.

 

Well...I am assuming the number of people online will always be at the beginning of the string, right?

 

So you can just use an explode on it and it should be the first value stored in your array all the time.

Link to comment
https://forums.phpfreaks.com/topic/54584-preg_match/#findComment-269913
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.