However, though I understand PHP well, I can't understand PERL: like making database connections.
I've a curious question, is PERL better than PHP. My intension to use PERL is to code a spider that can quickly fetch 'backlinks' and 'urls' for a Web site.
Please show me the direction. I don't like theory much (some basics are surely, I need read). Fine examples, that I can test on local Windows/Apache, I hope makes me understand PERL.
I would like to repeat my first question: is PERL better than PHP? (context Web spider).
In this case I would use the language you are most comfortable with that will allow you to design your code with ease the whole while maintaining a strong measure of security and a path for future patches and enhancements.
As far as learning the language itself, it nevers hurts to have another tool in your belt. Perl is powerful and fun, as is PHP.
However, though I understand PHP well, I can't understand PERL: like making database connections.
Perl is not that much different than php, really. You connect to DB's using the perl module DBI, which can connect to various database types.
[search.cpan.org...]
If you want to start playing with databases on your local machine, download and install a local copy of mysql.
[dev.mysql.com...]
You can then write a few example scripts and just execute them in DOS (Start->Run, type cmd for XP, command for win 98.) Let the fun begin! :-)
I've one specific question (I mentioned already):
Is PERL more suitable for making a spider/crawler. What about PHP Snoopy and PHP cURL in context to if better PERL can do..
With Google inspiration, I hope to make a spider for crawling and indexing Indian Web sites. May be just a study or research.
Is PERL more suitable for making a spider/crawler
Perl has some modules that help spidering and parsing of pages. This is why I think in this case it's better than PHP. I'd look at LWP::RobotUA and HTML::TokeParser for fetching and parsing the pages respectively. One of the last chapters of "LWP&Perl" goes through the development of a spider, I think they use those modules (don't have the book handy).
Sean
Sure you can.
In fact, CGI is even easier with PHP than with Perl (at least it requires less code).
CGI Parameters passed into a PHP script do not have to be "unpacked" as they do in Perl, and they are automatically assigned to variables named after their respective parameter names. They are also contained in holder arrays, like $_POST and $_GET. See [php.net...]
Personally, when working with databases, I prefer using PHP's internal database interaction functions to Perl's DBI module.
The "automated" unpacking and variable assigning can make for sloppy programming if you are not careful (can we say "register globals"? Yuck!)
I feel that for something like spidering websites, Perl is far superior to PHP. Also, if what I'm talking about is beyond the scope of what you're trying to accomplish, you can use PHP to retrieve individual pages based on user input, but don't use curl, use the built-in PHP functions (something like file_get_contents.. I forget the actual function name).
For mass spidering though, Perl is the way to go.