Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Releases
Non-local Online Users Script -- Evaluate my Code
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Brackson" data-source="post: 227006" data-attributes="member: 34747"><p>[PHP]<html></p><p><?php</p><p>include 'simple_html_dom.php';</p><p>// Download here http://sourceforge.net/projects/simplehtmldom/files/simple_html_dom.php/download // It parses the HTML so we can get the div from the source easier thank using regular expression.</p><p> </p><p>$url = "http://xenon.pw/?novote";</p><p>// The URL of the retro that you want to use.</p><p> </p><p>$html = file_get_html($url);</p><p>// Gets the HTML source of that link and stores it in a variable.</p><p> </p><p>$ret = $html->find('div[id=online]');</p><p>// Finds the div where online user count is stored.</p><p> </p><p>$onlineusers = (strip_tags($ret[0]));</p><p>// Converts the div into non-markup'ed text.</p><p> </p><p>echo $onlineusers;</p><p>// Echos the online users!</p><p> </p><p>?></p><p></html>[/PHP]</p><p> </p><p>Updated code.</p><p> </p><p>Thanks Heaplink for advising not to use regular expression. This way is a lot easier to use, and a lot easier on the eyes!</p></blockquote><p></p>
[QUOTE="Brackson, post: 227006, member: 34747"] [PHP]<html> <?php include 'simple_html_dom.php'; // Download here http://sourceforge.net/projects/simplehtmldom/files/simple_html_dom.php/download // It parses the HTML so we can get the div from the source easier thank using regular expression. $url = "http://xenon.pw/?novote"; // The URL of the retro that you want to use. $html = file_get_html($url); // Gets the HTML source of that link and stores it in a variable. $ret = $html->find('div[id=online]'); // Finds the div where online user count is stored. $onlineusers = (strip_tags($ret[0])); // Converts the div into non-markup'ed text. echo $onlineusers; // Echos the online users! ?> </html>[/PHP] Updated code. Thanks Heaplink for advising not to use regular expression. This way is a lot easier to use, and a lot easier on the eyes! [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
Non-local Online Users Script -- Evaluate my Code
Top