You are here: Big Brother Bot ForumGeneral CategoryGeneral DiscussionMaking use of: Master List
Pages: [1]   Go Down
  Print  
Author Topic: Making use of: Master List  (Read 591 times) Bookmark and Share
Support Hero
*
OS: Windows
Type: Gameserver Rental Co.
Gameservers: 2x CoD4, 1x BF3
Posts: 2627
Offline Offline
Owner of Host4B3.com - Over 70 bots hosted!
WWW
« on: April 27, 2011, 07:02:24 AM »

Ok, he comes the php/html n00b questions....

I would like to use the master list and I made a URL with the info found here. The question I have now is how to "pull" the data...

Meaning, I make a webpage. If I paste the link, it just shows the link. if I make a iframe, i will show the contents of the link, but then I get ti deal with scroll bars. I wish to show the contents of the link without using a iframe if possible, but not sure how...

Does anyone have any code I can use (HTML please) to "pull" the data from a link?
Logged

Need B3 Bot hosting? Check out Host4B3.com
Check Twitter.com/Host4B3 for updates if the site it down.

Help will be given to those with a b3.log

System: Python 2.7.1 - B3 Source Code - Locally hosted MySQL & Apache - Win 2k3

Beta Testers
*
OS: Linux
Type: Owner dedicated server(s)
Posts: 234
Offline Offline
« Reply #1 on: April 27, 2011, 07:35:52 AM »

With HTML, only when you are tricky with disabling scrollbars and so on (see selfhtml for this), with PHP you should be able to get via fopen or sth else the html source and you can parse the things you want.
Logged
Support Hero
*
OS: Windows
Type: Gameserver Rental Co.
Gameservers: 2x CoD4, 1x BF3
Posts: 2627
Offline Offline
Owner of Host4B3.com - Over 70 bots hosted!
WWW
« Reply #2 on: April 27, 2011, 07:42:03 AM »

hmm...
Can you elaborate on the php code needed?

Also, when I use a url such as this
http://www.bigbrotherbot.com/master/?server=SNT&hl&hr

There is some white text. Can I somehow make that text black so it can be seen better...
Logged

Need B3 Bot hosting? Check out Host4B3.com
Check Twitter.com/Host4B3 for updates if the site it down.

Help will be given to those with a b3.log

System: Python 2.7.1 - B3 Source Code - Locally hosted MySQL & Apache - Win 2k3
Beta Testers
*
OS: Linux
Type: Owner dedicated server(s)
Posts: 234
Offline Offline
« Reply #3 on: April 27, 2011, 08:07:34 AM »

Actually my time is a bit limited, I can just give you short overview:

1. For parsing homepages, an okay given by the site owner is helpful.

2. Read a page:
Code: PHP

$url = "http://www.bigbrotherbot.com/master/?server=SNT&hl&hr";
$file = file_get_contents($url); // lookup for PHP commands in php.net manual
echo $file; // gives out the complete page
?>
seems like there is a forum bug with the PHP opener "<?php".

3. Easy version for multiple replaces:
Code: PHP
$searchfor = array ( );
$searchfor[0] = '/#ffffff/';  // the "/" is necessary
$searchfor[1] = '/something else/'; // other replacements

$replacewith = array ( );
$replacewith[0] = '#000000';
$replacewith[1] = 'something else'; // other replacements

// replace and echo:
$file = preg_replace($seachfor, $replacewith, $file);
echo $file;
google for "regular expressions" to see what is possible too, they are nice things to get information out of a string or to modify any given string. But unfortunatly I'm not experienced with them.

All the code is untested but might work Wink

Logged
Support Hero
*
OS: Windows
Type: Gameserver Rental Co.
Gameservers: 2x CoD4, 1x BF3
Posts: 2627
Offline Offline
Owner of Host4B3.com - Over 70 bots hosted!
WWW
« Reply #4 on: April 27, 2011, 08:57:28 AM »

Actually my time is a bit limited, I can just give you short overview:

1. For parsing homepages, an okay given by the site owner is helpful.

2. Read a page:
Code: PHP

$url = "http://www.bigbrotherbot.com/master/?server=SNT&hl&hr";
$file = file_get_contents($url); // lookup for PHP commands in php.net manual
echo $file; // gives out the complete page
?>
seems like there is a forum bug with the PHP opener "<?php".

3. Easy version for multiple replaces:
Code: PHP
$searchfor = array ( );
$searchfor[0] = '/#ffffff/';  // the "/" is necessary
$searchfor[1] = '/something else/'; // other replacements

$replacewith = array ( );
$replacewith[0] = '#000000';
$replacewith[1] = 'something else'; // other replacements

// replace and echo:
$file = preg_replace($seachfor, $replacewith, $file);
echo $file;
google for "regular expressions" to see what is possible too, they are nice things to get information out of a string or to modify any given string. But unfortunatly I'm not experienced with them.

All the code is untested but might work Wink


Ok, that first bit of code works perfect.

As for a ok by site owner, afaik, I have a ok to use the master list. that is what the page says...

As for the color replacement, I got a eval error when I tried it, but I will have to mess around with it.
Logged

Need B3 Bot hosting? Check out Host4B3.com
Check Twitter.com/Host4B3 for updates if the site it down.

Help will be given to those with a b3.log

System: Python 2.7.1 - B3 Source Code - Locally hosted MySQL & Apache - Win 2k3
Beta Testers
*
OS: Linux
Type: Owner dedicated server(s)
Posts: 234
Offline Offline
« Reply #5 on: April 27, 2011, 02:41:21 PM »

damn it, stupid typo error. I just forgot the "r" at $searchfor in the preg_replace function.

I tested it now, works fine.

The regular expressions wikipedia article tells some good basics about regular expressions. I guess it's not too hard to change the visualization of the table
Logged
Support Hero
*
OS: Windows
Type: Gameserver Rental Co.
Gameservers: 2x CoD4, 1x BF3
Posts: 2627
Offline Offline
Owner of Host4B3.com - Over 70 bots hosted!
WWW
« Reply #6 on: April 29, 2011, 05:06:30 AM »

Thank you very much.
I have completed my page with your help.
Logged

Need B3 Bot hosting? Check out Host4B3.com
Check Twitter.com/Host4B3 for updates if the site it down.

Help will be given to those with a b3.log

System: Python 2.7.1 - B3 Source Code - Locally hosted MySQL & Apache - Win 2k3
Tags:
Pages: [1]   Go Up
  Print  
 
Jump to:  


Rate this page +1 at Google Search


SimplePortal 2.3.1 © 2008-2009, SimplePortal