Posted: Thu Nov 02, 2006 5:25 pm Post subject: Best way of doing this
Hi there!
I'm in the process of making a bot that can show your MSN status through an image, like Ben's Bot, WebDP, all of them.
It's mainly just to expand my knowledge with Perl, but I'm wondering if theres a better way of doing it.
What I'm currently doing is when someone adds the bot, it creates a PHP file (and uploads it) that looks at an ini file on the web server I have, and gets the user's status and displays it. Meanwhile I have it writing everyone's status to an ini file, and uploading that every 10 seconds (it only uploads if someone has changed their status since last time) through FTP.
No matter if the ini file gets uploaded or not, the script will "ping" my site to tell the site that the bot is still running.
If you understand that, please tell me, is there a better way at doing this?
I thought about doing it that way, but the problem I encountered was that the user's email is encrypted, and that can get quite long at times. As far as I know PHP only allows 100 characters when using get, so I didn't do it. Also, if the contact list got quite big, I'm wondering if it would take longer to do it that way or not.
Thanks so much for your reply! Any other suggestions?
Query string limits are in your server configuration, not PHP. An alternative is to use POST instead of GET...
Code:
use LWP::UserAgent;
my $ua = new LWP::UserAgent;
$ua->post ('http://domain/status.php', {
username => $user,
status => 'online',
});
There's no set size limit on POST as far as I know unless your script explicitly specifies one. _________________ Current Site (2008) http://www.cuvou.com/
Thanks so much for the code, I'll try it out tomorrow when I wake up. Do you think doing that for each user will be faster than uploading a single text file?
I'll post any results I come up with tomorrow. Thanks again!
Sorry for the late reply, I've been mucking around with a Perl Web Crawler.
I managed to get my bot's contact list up to 16 online people, and tried the Post method. It was around 6 seconds slower than uploading the single text file, so I think I'll stick with the text file.