Results 1 to 2 of 2

Thread: Breaking Apart Large String for information

  1. #1
    Join Date
    Jan 2006

    Breaking Apart Large String for information

    Ok...so I'm trying to get a function to get information from an invisionfree forum...ie Active Members/Guests/Hidden Users....total posts....List of users currently on....stuff like that. I know you need to use file_get_contents() to get the code, but once I get that, I'm stuck. The page I'm specifically doing this for is http://omnimaga.dyndns.org/index.php?act=idx but it really should work for any invisionfree forum.

    The information that i need is in this part of the string:

    HTML Code:
        <br />	<!-- Board Stats -->
        <br />
    	<div align='center'>
    		<a href='http://omnimaga.dyndns.org/index.php?amp;act=Stats&amp;CODE=leaders'>The moderating team</a> |
    		<a href='http://omnimaga.dyndns.org/index.php?amp;act=Search&amp;CODE=getactive'>Today's active topics</a> |
    		<a href='http://omnimaga.dyndns.org/index.php?amp;act=Stats'>Today's top 10 posters</a> |
    		<a href='http://omnimaga.dyndns.org/index.php?amp;act=Members&amp;max_results=10&amp;sort_key=posts&amp;sort_order=desc'>Overall top 10 posters</a>
        <br />
    	<div class="tableborder">
    		<div class="maintitle">Board Statistics</div>
    		<table cellpadding='4' cellspacing='1' border='0' width='100%'>        <tr>
               <td class='pformstrip' colspan='2'>17 user(s) active in the past 60 minutes</td>
              <td width="5%" class='row2'><img src='http://omnimaga.unitedti.org/sphere2.gif' border='0' alt=''></td>
              <td class='row4' width='95%'>
                <b>10</b> guests, <b>6</b> members, <b>1</b> anonymous members
                <div class='thin'><a href='http://omnimaga.dyndns.org/index.php?amp;showuser=11'><span style='color:#009'><b>tenniskid493</b></span></a>, 
    <a href='http://omnimaga.dyndns.org/index.php?amp;showuser=104'><span style='color:#800'><b>Killerplayer</b></span></a>, 
    <a href='http://omnimaga.dyndns.org/index.php?amp;showuser=95'><span style='color:#800'><b>Super Speler</b></span></a>, 
    <a href='http://omnimaga.dyndns.org/index.php?amp;showuser=26'><span style='color:#005000'><b>Ranman</b></span></a>, 
    <a href='http://omnimaga.dyndns.org/index.php?amp;showuser=193'><span style='color:#800'><b>netham45</b></span></a>, 
    <a href='http://omnimaga.dyndns.org/index.php?amp;showuser=3'><span style='color:#005000'><b>rivereye</b></span></a></div>
                Show detailed list by: <a href='http://omnimaga.dyndns.org/index.php?amp;act=Online&amp;CODE=listall&amp;sort_key=click'>Last Click</a>, <a href='http://omnimaga.dyndns.org/index.php?amp;act=Online&amp;CODE=listall&amp;sort_key=name&amp;sort_order=asc&amp;show_mem=reg'>Member Name</a>
            </tr>        <tr>
               <td class='pformstrip' colspan='2'>Today's Birthdays</td>
              <td class='row2' width='5%' valign='middle'><img src='http://omnimaga.unitedti.org/sphere2.gif' border='0' alt=''></td>
              <td class='row4' width='95%'><b></b> No members are celebrating a birthday today<br /></td>
            </tr>		   <tr>
    		     <td class='pformstrip' colspan='2'>Board Statistics</td>
    			 <td class='row2' width='5%' valign='middle'><img src='http://omnimaga.unitedti.org/sphere2.gif' border='0' alt=''></td>
    			 <td class='row4' width="95%" align='left'>Our members have made a total of <b>14131</b> posts<br />We have <b>129</b> registered members<br />The newest member is <b><a href='http://omnimaga.dyndns.org/index.php?amp;showuser=199'>Weregoose</a></b><br />Most users ever online was <b>31</b> on <b>25 Sep, 2006, 22:21</b></td>
    		   </tr>         </table>
    Can someone help me out with the string manipulation to store the information into variables. I would need, the total number of posts, number of registered users, newest member, most users online and date, today's birthdays, the current list of active members, and # of active Members/Guests/Hidden Members.

  2. #2
    Join Date
    Sep 2005
    Portland Oregon
    Start with
    $ar = explode('\n', $str);
    foreach($ar as $line) {
      $results = array();
      $myData = preg_match('/yur pattern to match/', $line, $results);
      if( $results )
        // walk through the array or returned pattern matches.
    Not gonna try to write the actual code for you but maybe that will get you pointed in the right direction.


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles