codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  link spider  theodore at 16:51 on Thursday, August 10, 2006
 

hello
i am new to perl.

i need a programm like a "spider" that collects all links from a website (not only the first page) and store them into a file or into a database(access).

is it possible...?...pls help

  Re: link spider  javabits at 07:56 on Friday, August 11, 2006
 

if you need to do it in perl, yes it's possible. One of the easier ways would be to install the module WWW::Mechanize (search for it on search.cpan.org).

You can basically create a WWW:Mechanize object to go to a page and use the $mech->links() function to get a list of links. inserting it into a db should be simple enough depending on what db you plan on using.

semper fi...

  Re: link spider  theodore at 08:53 on Friday, August 11, 2006
 

could help a little more??

maybe an example?

thanx

  Re: link spider  javabits at 22:51 on Friday, August 11, 2006
 

The following is pretty basic (remember you need to install WWW::Mechanize first)

If you want additional examples google is your friend.

Here's one article to get you started though

http://hacks.oreilly.com/pub/h/946

#!/usr/bin/perl
use strict;

# includes
use WWW::Mechanize;
use HTTP::Cookies;

# start
my $client = WWW::Mechanize->new();
$client->get( "http://www.yahoo.com" );
print $client->success();
for my $link ($client->links()) {
print $link->[0];
print "\n";
}









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  static asp url by 404 custom error code for Search Engine
•  Newbie needs Help
•  Need expertise - converting
•  Re: link spider
•  Re: Yahoo Tabbed menu control
•  Re: Insert Contents of .txt file into a .html page
•  Re: strange Perl loop
•  Re: need help writing a simple perl script
•  Pass a variable to open popup window w/o forms


Recent Articles
What is a pointer in C?
Multiple submit buttons with form validation
Understanding Hibernate ORM for Java/J2EE
HTTP screen-scraping and caching
a javascript calculator
A simple way to JTable
Java Native Interface (JNI)
Parsing Dynamic Layouts
MagicGrid
Caching With ASP.Net


© Copyright codetoad.com 2001-2006