Pulling Online Users

This is a continuation from this question: http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/Q_28502915.html

I've pulled the total members and total posts successfully but unable to get the current members online.

Here is the current code, but returns nothing:
//Get current stats from SCB
$page = file_get_contents("http://forums.starcitizenbase.com");
preg_match_all("/<span class='value'>([\d,]*)<\/span>/", $page, $match);
//var_dump($match);
$total_post = $match[0][0];
$total_member = $match[0][1];
$total_online = preg_match_all("/<h4 class='statistics_head clearfix'>([\d,]*)<\/h4>/", $page, $match);
echo 'total online: '.$total_online;
LVL 12
Nathan RileyFounderAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
Please see a continuation of the theme: http://iconoun.com/demo/temp_nathan_riley.php

Moving parts are near line 88.  Note that there may be other counts of users doing stuff; I just look for the users online today.

<?php // /demo/temp_nathan_riley.php
error_reporting(E_ALL);

// SEE http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/Q_28502915.html

// A CURL FUNCTION WRAPPER
// A FUNCTION TO RUN A CURL-GET CLIENT CALL TO A FOREIGN SERVER
function my_curl
( $url
, $timeout=5
, $error_report=TRUE
)
{
    $curl = curl_init();

    // HEADERS AND OPTIONS APPEAR TO BE A FIREFOX BROWSER REFERRED BY GOOGLE
    $header[] = "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
    $header[] = "Cache-Control: max-age=0";
    $header[] = "Connection: keep-alive";
    $header[] = "Keep-Alive: 300";
    $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
    $header[] = "Accept-Language: en-us,en;q=0.5";
    $header[] = "Pragma: "; // BROWSERS USUALLY LEAVE THIS BLANK

    // SET THE CURL OPTIONS - SEE http://php.net/manual/en/function.curl-setopt.php
    curl_setopt( $curl, CURLOPT_URL,            $url  );
    curl_setopt( $curl, CURLOPT_USERAGENT,      'Mozilla/5.0 (Windows NT 6.1; rv:22.0) Gecko/20100101 Firefox/22.0'  );
    curl_setopt( $curl, CURLOPT_HTTPHEADER,     $header  );
    curl_setopt( $curl, CURLOPT_REFERER,        'http://www.google.com'  );
    curl_setopt( $curl, CURLOPT_ENCODING,       'gzip,deflate'  );
    curl_setopt( $curl, CURLOPT_AUTOREFERER,    TRUE  );
    curl_setopt( $curl, CURLOPT_RETURNTRANSFER, TRUE  );
    curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, TRUE  );
    curl_setopt( $curl, CURLOPT_TIMEOUT,        $timeout  );
    curl_setopt( $curl, CURLOPT_VERBOSE,        TRUE   );
    curl_setopt( $curl, CURLOPT_FAILONERROR,    TRUE   );


    // IF USING SSL, THESE MAY BE IMPORTANT
    curl_setopt( $curl, CURLOPT_SSL_VERIFYHOST, FALSE  );
    curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, FALSE  );
    curl_setopt( $curl, CURLOPT_SSLVERSION,     3      );

    // RUN THE CURL REQUEST AND GET THE RESULTS
    $htm = curl_exec($curl);

    // ON FAILURE
    if ($htm === FALSE)
    {
        // VISUALIZE ERROR MESSAGES
        if ($error_report)
        {
            $err = curl_errno($curl);
            $inf = curl_getinfo($curl);
            echo "CURL FAIL: $url TIMEOUT=$timeout, CURL_ERRNO=$err";
            var_dump($inf);
        }
        curl_close($curl);
        return FALSE;
    }

    // ON SUCCESS RETURN XML / HTML STRING
    curl_close($curl);
    return $htm;
}

// READ FROM THE URL
$url = 'http://forums.starcitizenbase.com/';
$htm = my_curl($url);

// PARSE THE WEB PAGE CONTENT
$sig = "<div id='board_stats'>";
$arr = explode($sig, $htm);
$sig = '</div>';
$arr = explode($sig, $arr[1]);
$str = strip_tags($arr[0], '<span>');

$sig = "<span class='value'>";
$arr = explode($sig, $str);

// GET POSTS AND MEMBERS
$p = preg_replace('/[^0-9,]/', NULL, $arr[1]);
$m = preg_replace('/[^0-9,]/', NULL, $arr[2]);

// SHOW THE WORK PRODUCT
echo "POSTS: $p, MEMBERS: $m, ";

// FIND USERS ONLINE
$sig = 'users are online';
$arr = explode($sig, $htm);
$str = substr($arr[0], -10);
$str = preg_replace('/[^0-9,]/', NULL, $str);
echo "ONLINE: $str";

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Nathan RileyFounderAuthor Commented:
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.