Gossamer Forum
Home : Products : Links 2.0 : Customization :

Deadlink Auto Report Mod

Quote Reply
Deadlink Auto Report Mod
Hi,

I've just installed the Deadlink Auto Report mod I found in the Links Resources - I chose this one because I thought it would save people reporting links that weren't dead just to bother me.

Its a great script and works fine except when it comes to URL's with a redirect on them (such as some of my affiliated/sponsored links in the database). It seems to be reporting some of the affiliated URL's as dead links and others it doesn't, however when I check the links in the email that gets automatically sent, they all work fine.

Is there some code that could be added to the mod to make it ignore URL's with re-directs and just report 404 and 500 server errors?

Any help is appreciated :)

Mandi

Quote Reply
Re: Deadlink Auto Report Mod In reply to
I added the following conditional statement in my jump.cgi for Links SQL (which are based on earlier codes I was using in Links 2.0)...

Code:

if ($res->is_error eq '404') {
&send_email;
}


You might have to tweak the above codes a bit to make them work in Links 2.0, but they do work fine in Links SQL....

I was getting an average of 15 inaccurate emails a day, now I get about one error accurate message sent every few days.

Regards,

Eliot Lee

Quote Reply
Re: Deadlink Auto Report Mod In reply to
Thanks for replying Eliot!

I'll apologize in advance, because I'm not actually sure where to put the code in the jump.cgi file, or how to tweak it to get it to work. Blush I can only just get a script working by following the instructions, hehe.

I am guessing that the code will need to be put into this section:

# Now let's send the user to the url..
## MOD Deadlink 02S
if ($goto) {
if((!head($goto)) or (!get($goto))) {
&reportlink;
print "Location: $build_root_url/404.html \n\n";
}
else {
print "Location: $goto \n\n";
}
}
else {
&error ("Record not found ($in{$db_key})");
}
}


However I'm not sure if that is the case. I hate to be a pain in the butt - I am just clueless when it comes to scripting.

Thanks for your time,
Mandi

Quote Reply
Re: Deadlink Auto Report Mod In reply to
It looks like you are using totally different LWP codes than I am...one suggestion is replacing the following codes:

Code:

if((!head($goto)) or (!get($goto))) {


with the following codes:

Code:

if($res->error eq '404') {


Now...I do not gaurantee that these codes will work since you are using a totally different set of codes and probably different LWP codes. How would you know if they are different codes? (You might ask.) Well, if you do not have $res defined anywhere in the jump.cgi, then you are using totally different codes.

Regards,

Eliot Lee



Quote Reply
Re: Deadlink Auto Report Mod In reply to
I tried every thing here in this thread, but it still doesn't work. I still get the 404 errors with redirect URL's.

Lmax

Quote Reply
Re: Deadlink Auto Report Mod In reply to
Welp...don't know what to tell you because I believe you are using Sockets rather than LWP. So, without using LWP, the codes I provided will not work. The Socket method does not extract error message numbers, it simply uses GET first, then the HEAD method to see if the link exists...it does not differentiate between 302,303,403,404,500 error messages.

So, either re-write the Socket codes to use LWP (examples of using LWP are located at http://lookhard.hypermart.net/links-mods/) OR come to grips that you will receive a bunch of inaccurate email messages.

Regards,

Eliot Lee

Quote Reply
Re: Deadlink Auto Report Mod In reply to
Hi,

Couple of things... The Deadlink Auto Report Mod is an update of an existing script... I simply ported an existing script and incorporated it into Links 2.0 as the old one didn't quite tackle the problem as well as I'd have liked.

As things stand at the moment, the script does not differentiate between returned headers... It simply returns errors for any pages that it experiences anything other than a successful retrieval.

I'll be looking at improving it so that it uses LWP properly and differentiates between genuine errors and redirects, etc...

Hang in there and the updates will soon be here.

Thanks

Martin

- - - -
The impossible we can handle now
Miracles take a little longer
Quote Reply
Re: Deadlink Auto Report Mod In reply to
Heya,

I tried to replace the code you (Eliot) suggested may work in the jump.cgi file, however it gave me several fatal errors when clicking on any link. I appreciate your time though! Smile

I'm not sure about Sockets and LWP, however I do know that I had to search everywhere to get a copy of LWP::Simple to put in my LWP directory before the script would work. However, as you said - there were no other $res references in the jump.cgi file so the coding was different and it probably wouldn't work.

Martin - I'm looking forward to any updates you do on the script. It will probably be one of the most handy mods I use on my site once its up and running properly.

Best Regards,
Mandi