Posted: Fri Sep 30, 2005 10:56 am Post subject: Apache
I have a bot that a friend and I are making together. I'm trying to install apche web server (which I've done.). I made a little form that adds a reply to the bot (tested and everything). Now, I need to figure out how to make it so he can access the server. I would like to do this without paying if possible.
Is the Apache server on your own computer (/or the computer the bot runs on)? If so, the bot can get into the server's files anyway without having to go through the HTTP protocol...
Like if your root is C:/public_html, and your add-replies being in C:/public_html/cgi-bin/addreply.cgi, and your reply list being in public_html/replies.txt, you would just open that through your bot...
Code:
open (REPLIES, "C:/public_html/replies.txt");
Or if you don't like doing that or if the bot isn't on the same computer as your Apache server, use LWP::Simple or LWP::UserAgent to request the file's URI...
Code:
my $replies = LWP::Simple::get "http://localhost/replies.txt";
'localhost' would be okay if the server was elsewhere on your local network. If it was on an entirely different network altogether you'd probably use its external IP address to access it...
edit
I'll give you a real example...
I run my own Apache server too, which aichaos.com and my bot runs off of. So my Aiden bot has a plugin that updates the "aiden.stats" page AiChaos every 5 minutes...
Server Root = D:/Web/AiChaos/
Code:
# AiChaos handler: updating stats file.
&queue ('statz', 15, "\&uploadstats();");
sub uploadstats {
# Get the stats.
my @stats = &stats();
my $stamp = ×tamp();
# Write.
my $src = '<b class="header">:: Aiden Current Statistics</b><p>
# Send it.
open (PAGE, ">D:/Web/AiChaos/vfive/pages/aiden.stats.txt");
print PAGE $src;
close (PAGE);
# Another one in 5 mins.
my $next = 60*5;
&queue ('stats',$next,"\&uploadstats();");
}
1;
This kinda does things in reverse of what you're looking for, but it's a good example nonetheless. In this, the bot writes a file to the server's public directory. You'd just open a file in read mode to read a file from the server's directory as usual. _________________ Current Site (2008) http://www.cuvou.com/
I think you misunderstood. I know how to do the addreply part. My computer has apache and the bot on it. I need to find a way for a friend in a different network to access my apache server. Is there a way to do this without a domain name? Something said my ip address was private? (any idea what that means)?
I think you misunderstood. I know how to do the addreply part. My computer has apache and the bot on it. I need to find a way for a friend in a different network to access my apache server. Is there a way to do this without a domain name? Something said my ip address was private? (any idea what that means)?
Ohh, I get what you mean now...
You'll need access to open a port to your external IP address. Your external IP is whatever a site such as whatismyip.com would tell you. If you're behind a router or something you'll have to direct that port to your specific computer.
You can get free DNS services, for example www.cjb.net when you set up your domain forwarding, leave most of the fields blank but next to "IP Address" you'd put your IP.... then your .cjb.net site would be like an alias to your computer.
But beyond that, there's then the issue of dynamic IP addresses. If you're on a system like dial-up, for example, your IP address probably changes VERY often. In a case like that, servers aren't effective because it's very difficult to find your server each time the IP changes. So it's best to have like a cable modem or otherwise having an IP that very rarely changes. _________________ Current Site (2008) http://www.cuvou.com/
I use DSL. But I also have 2Wire for wirless internet. If I go to a site that shows you your ip(not sure if it changes), and put that in the address bar, I get an error. If I use the IP given by 2Wire (which doesn't change), it loads apache.
Edit: I figured it out. I had to set it up so it would allow Apache through the firewall. It then gave me a special IP for it which allows other people to get to me server.