View Full Version : Reading the Web from Perl
Javier Mosqueda
03-11-2000, 01:36 PM
To open a file in my own domain is easy:
open(HANDLE,"../www/myfile.txt");
cause I know the structure of the directory.[nbsp][nbsp]
But how can I read something from another domain of which I only know its URL? (http://anotherdomain.???)[nbsp][nbsp]My idea is to grab some news or quotes from other sites and include them in any of my pages.
Suggestions highly appreciated.
------------------
Javier Mosqueda
crystalking.com (http://crystalking.com)
Justin
03-11-2000, 03:25 PM
Try the LWP libraries:
</font><font face="Courier" size="3">
use LWP::Simple;
$text = get ("http://foo.bar/page.html");
</font><font face="Verdana, Arial" size="2">
Or something to that affect. Best way to find out is to do a search for LWP at any good Perl site.
------------------
Justin Nelson
FutureQuest (http://www.FutureQuest.net/index.php) Support
Javier Mosqueda
03-12-2000, 08:18 PM
Hi Justin:
Thanks for your advise.[nbsp][nbsp]I just went to my CGI-BIN directory, uploaded a little routine:
#!/usr/bin/perl
use LWP::Simple;
print "Content-type:text/html\n\n";
$pag = get("http://excite.com");
print $pag;
And it worked perfect, except for certain relative references to some GIF's that Excite calls, (which I don´t need), I basically need news, some quotes and simple little things from other sites.[nbsp][nbsp]I also wanted to thank you for your support and to let you know that all worked fine.
So far, that´s all I need from the LWP.[nbsp][nbsp]Processing the "absorbed" page to extract what I need will be fun.[nbsp][nbsp]
Regarding other functions from LWP, I downloaded the whole library from http://www.linpro.no/lwp/, the file "libwww-perl-5.46.tar.gz", but there is no real manual, any suggestion on where to obtain it?.
Thanks
------------------
Javier Mosqueda
crystalking.com (http://crystalking.com)
fuddmain
03-12-2000, 08:44 PM
You may want to check out www.perl.com (http://www.perl.com) and check out the article on RSS.[nbsp][nbsp]RSS is how headlines from numerous sites are shared and used as "channels".[nbsp][nbsp]If you're familiar with Netscape's portal or Slashdot you've seen this in action.
The article does a much better job of explaining it than me, so I'll shutup.
------------------
Brian
vBulletin® v3.6.8, Copyright ©2000-2012, Jelsoft Enterprises Ltd.