| Author |
Message |
Paulxb
Nuke Cadet


Joined: Jul 01, 2003
Posts: 7
|
Posted:
Mon Jun 30, 2003 8:25 pm |
  |
Hello
I own a gaming site that is starting to get a lot of traffic, and one problem I am having is managing the Map Downloads section.
My map downloads are stored on a remote server that I link to, so I basically have to manually enter every link, which is starting to become a pain as the map database grows. I am using the standard Downloads section that comes with phpNuke.
Is there a module that will read the contents of a remote folder, and build a list of links in my phpsite? This would save me a ton of time, all I would have to do is upload the maps to the remote server, then my site could grab them with no effort.
Thanks for listening
Paulxb
www.NinjaVsPirates.com |
|
|
   |
 |
allevon
Site Mod


Joined: Nov 22, 2002
Posts: 716
Location: New Jersey
|
Posted:
Tue Jul 01, 2003 4:19 am |
  |
Honestly Paul,
Up until now, I have never heard of a module that can read the contents of a remote server for you to create a list with. If it did exist, I would use it. Also, it would be a great time saver for future work I have to do as well like yourself. |
_________________ "Give Me Liberty, Or Give Hackerz Death!!!"
Patrick Henry Revised for 21st century.
Let The Bodies Hit The Floor! Let The Bodies Hit The Floor! |
|
    |
 |
Paulxb
Nuke Cadet


Joined: Jul 01, 2003
Posts: 7
|
Posted:
Tue Jul 01, 2003 9:34 am |
  |
Well it has to be possible for it to work on the same server, the Blocks manager can read its own folder. If you can do it on the same server, I'm sure it can be done remotely some how. |
|
|
   |
 |
snarfies3
Nuke Soldier


Joined: May 24, 2003
Posts: 22
|
Posted:
Tue Jul 01, 2003 2:02 pm |
  |
| Paulxb wrote: |
| Well it has to be possible for it to work on the same server, the Blocks manager can read its own folder. If you can do it on the same server, I'm sure it can be done remotely some how. |
As to doing it locally, the upcoming 2.0 version of Nukestyle's download module is supposed to be able to do that, and thank goodness SOMEBODY has finally done it. Makes my life so much easier. |
|
|
    |
 |
Paulxb
Nuke Cadet


Joined: Jul 01, 2003
Posts: 7
|
Posted:
Mon Jul 07, 2003 4:25 pm |
  |
Hey, after some snooping, I found this:
http://www.onlinetools.org/tools/easyfilebrowse.php
This little file will display the files in a folder as a searchable database, which rocks.
seems to do what I want, now I just need to figure out how to display a remote page within my phpnuke site. Is that possible??
An example would be player game stats. The normal stats can be seen here:
http://ws6-2.wickedservers.com/stats/
I'd like to have a link to that in the content menu, and have it show in the main site, not open in a new window. |
|
|
   |
 |
Raven
General


Joined: Mar 22, 2003
Posts: 5233
Location: USA
|
Posted:
Mon Jul 07, 2003 4:50 pm |
  |
In general, to screen scrape pages with PHP, use the file_get_contents() function. It will pull back the raw HTML. You can then use various other PHP functions to extract exactly what you want/need and display it on your page
Exanple
| Code: |
$page_to_scrape = file_get_contents("http://ws6-2.wickedservers.com/stats/
");
echo $page_to_scrape; |
I will let you figure out the rest  |
_________________ Those who hear not the music think the dancers mad.
Raven Web Hosting|My Scripts & Stuff |
|
    |
 |
Paulxb
Nuke Cadet


Joined: Jul 01, 2003
Posts: 7
|
Posted:
Mon Jul 07, 2003 7:37 pm |
  |
Ugh! I'm a total newbie at this, and I can't get it to work in the Content section of the site. I want the original page (stats) to show within my site. Using your php I got nothing
I tried it with and without the .php open and close on it :
| Code: |
<?php
$page_to_scrape = file_get_contents("http://ws6-2.wickedservers.com/stats/
");
echo $page_to_scrape;
?> |
Any help? |
|
|
   |
 |
Raven
General


Joined: Mar 22, 2003
Posts: 5233
Location: USA
|
Posted:
Mon Jul 07, 2003 7:44 pm |
  |
|
    |
 |
Paulxb
Nuke Cadet


Joined: Jul 01, 2003
Posts: 7
|
Posted:
Mon Jul 07, 2003 8:05 pm |
  |
I am really bad at this...
Here's the "sample" .php module:
| Code: |
<?php
if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
die ("You can't access this file directly...");
}
$module_name = basename(dirname(__FILE__));
$index = 1;
function one() {
global $module_name;
include("header.php");
OpenTable();
echo "Addon Sample File (index.php) function \"one\"<br><br>";
echo "<ul>";
echo "<li><a href=\"modules.php?name=$module_name&file=index\">Go to index.php</a>";
echo "</ul>";
CloseTable();
include("footer.php");
}
function two() {
global $module_name;
include("header.php");
OpenTable();
echo "Addon Sample File (index.php) function \"two\"";
echo "<ul>";
echo "<li><a href=\"modules.php?name=$module_name&file=index\">Go to index.php</a>";
echo "</ul>";
CloseTable();
include("footer.php");
}
function AddonSample() {
global $module_name;
include("header.php");
OpenTable();
echo "Addon Sample File (index.php)<br><br>";
echo "<ul>";
echo "<li><a href=\"modules.php?name=$module_name&file=index&func=one\">Function One</a>";
echo "<li><a href=\"modules.php?name=$module_name&file=index&func=two\">Function Two</a>";
echo "<li><a href=\"modules.php?name=$module_name&file=f2\">Call to file f2.php</a>";
echo "</ul>";
echo "You can now use Administration interface to activate or deactivate any module. As an Admin you can always "
."access to your Inactive modules for testing purpouses.";
CloseTable();
include("footer.php");
}
switch($func) {
default:
AddonSample();
break;
case "one":
one();
break;
case "two":
two();
break;
}
?> |
...and then your sample
| Code: |
$page_to_scrape = file_get_contents("http://ws6-2.wickedservers.com/stats/
");
echo $page_to_scrape; |
*sigh* 1+1 is equaling 4 right now  |
|
|
   |
 |
Raven
General


Joined: Mar 22, 2003
Posts: 5233
Location: USA
|
Posted:
Mon Jul 07, 2003 8:10 pm |
  |
| Code: |
<?php
if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
die ("You can't access this file directly...");
}
$index = 1;
include("header.php");
OpenTable();
$page_to_scrape = file_get_contents("http://ws6-2.wickedservers.com/stats/
");
echo $page_to_scrape;
CloseTable();
include("footer.php");
?> |
Not tested but should work  |
_________________ Those who hear not the music think the dancers mad.
Raven Web Hosting|My Scripts & Stuff |
|
    |
 |
Paulxb
Nuke Cadet


Joined: Jul 01, 2003
Posts: 7
|
Posted:
Mon Jul 07, 2003 8:20 pm |
  |
| Quote: |
| Sorry, such file doesn't exist... |
Thanks for trying  |
|
|
   |
 |
Raven
General


Joined: Mar 22, 2003
Posts: 5233
Location: USA
|
Posted:
Mon Jul 07, 2003 8:28 pm |
  |
Works perfectly for me. Make sure you have installed the module correctly.
Create a folder like Link_DB and place it in the modules folder. Then, save this code to Link_DB/index.php
| Code: |
<?php
if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
die ("You can't access this file directly...");
}
$index = 1;
include("header.php");
OpenTable();
$page_to_scrape = file_get_contents("http://ws6-2.wickedservers.com/stats/");
echo $page_to_scrape;
CloseTable();
include("footer.php");
?>
|
Then goto Admin modules and activate it. I can show you on my site where it works if you need to see it  |
_________________ Those who hear not the music think the dancers mad.
Raven Web Hosting|My Scripts & Stuff |
|
    |
 |
Paulxb
Nuke Cadet


Joined: Jul 01, 2003
Posts: 7
|
Posted:
Mon Jul 07, 2003 8:37 pm |
  |
Oh, lol I didn't name it index.php. I realised it while I was reading your next post
Thanks for the help, but it doesn't appear to call it as it actually exists with the graphics, etc. This is a module that is probably wanted by all the CS Clans out there, but nobody has tackled it yet
It brings up a partial page, but no images or working links. |
|
|
   |
 |
Raven
General


Joined: Mar 22, 2003
Posts: 5233
Location: USA
|
Posted:
Mon Jul 07, 2003 8:41 pm |
  |
|
    |
 |
|
|