473,785 Members | 2,738 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Perl for checking broken link on a website

5 New Member
Hi Guys!


I am new on this forum and I am hoping that I could acquire help to improve my PERL skill.

My goal is to be able to create a report of all broken links from a website. Based from my understanding, PERL can go through to server directory and search for htm/html file and put it on an array. From this array I believe PERL can search for a "http://" string and emulate to click the URL. If the URL contains "Page cannot be found" then create and append to a log file.

My question, what is the best method to do this and what is the required library and syntax?

Also for searching the "htm" file on a server, assuming that I don't have access to get in to server directory (which is unlikely) , how do I get this done? and if I have an access to the server how do I get PERL to login to the server first before PERL search for "htm" file on a specific directory? or do I have to put the PERL .pl file on the server root directory and run it there?

I really appreciate if someone could help. Thank you.
Jan 24 '08
11 2916
KevinADC
4,059 Recognized Expert Specialist
Ummm yes I guess you can use 3rd party software to check broken link but you won't learn anything...
If the goal includes learning how to write perl code then by all means, proceed. But you did not mention that in your openning post. ;)
Jan 26 '08 #11
KevinADC
4,059 Recognized Expert Specialist
You will want to look into using File::Find to search in all the sub directories. But then you might not learn how to recurse through directories yourself. ;)


For internal links you might consider just checking if the file exists and is readable instead of trying to fetch files with get(). It should be much faster.

For links to external files you have to use get().

There are also bound to be links to the same file more than once, you may want to avoid checking for the same file. You can use a hash table to keep track of what links are already checked.

The "do{}until eof" construct is not necessary. You might want to look into HTML::LinkExtra ctor (I think thats the name) to find the links in the html documents.
Jan 26 '08 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2236
by: | last post by:
I am planning to develop a directory website (ASP.NET) which will contain links to hundreds of external web pages. In an effort to keep the directory up to date, I would like to trap (perhaps as an event) and then log when the user clicks on a broken link (page not found or server not available). Keep in mind that these are links to 3rd party pages not hosted on my website or server. I think I can do this using client side Java scripting,...
0
9748
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile. I need it to be compiled with threads. Anyone have any wisdom on how best to do this? Here's a transcript of my latest attempt. It's long; you might want to skip to the bottom, where I try "make" and the fatal errors start happening.
28
3350
by: Craig Cockburn | last post by:
I have a tool which tells me the number of times that visitors attempt to access a link from my site to an external site and what the response code received was. In the event of the remote site returning an error code, they are not sent to the remote site - why bother, it wouldn't work! Since I have over 1000 external links, this allows me to locate the broken links that people see the most often and fix those first. Conventional link...
2
8784
by: barrybevel | last post by:
Hi, I have a very small simple program below which does the following: 1) post a username & password to a website - THIS WORKS 2) follow a link - THIS WORKS 3) update values of 2 fields and post the form - ERROR! This works fine using firefox even with javascript turned off. But when using Perl (v5.8.8 on FC5) I get a page back stating an error has occured: "We're sorry, an error has occurred. Please review the error below There has...
21
34439
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
7
55146
numberwhun
by: numberwhun | last post by:
**NOTE: This article is written using the 5.8.8 Alpha2 release of Strawberry Perl. I am writing this article with much joy and glee. This is due to the fact that Active State no longer has a monopoly on the issue of Perl on the Windows platform As anyone who code's Perl on the Windows platform knows, the choice that you have (had) for Perl on Windows was Active State. It worked great for your scripting but when it came to installing...
10
6978
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration of section c. Not sure where went wrong as the web page displayed internal server error. Also, what is the error 543? and error 2114. Where to find the list of errors in websites as it is not the standard apache error. I could not find...
1
47488
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script. What You Need Any recent...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7496
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.