Forums / Suggestions / Better way to check links

Better way to check links

Author Message

Bruce Morrison

Sunday 02 November 2003 9:53:00 pm

Fantastic to see the link checker as part of ezPublish 3.2

The method of checking links is pretty inefficient as entire body of link to be checked is returned (using the fopen).

A better way to handle this is to use the HTTP HEAD method. This tells the server being checked only to return the HTTP headers.

The PEAR HTTP package contains a head function
http://pear.php.net/manual/en/package.http.http.head.php

http://cvs.php.net/co.php/pear/HTTP/HTTP.php?r=1.18

Cheers
Bruce
http://www.designit.com.au/

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Bård Farstad

Monday 03 November 2003 12:17:30 am

Hi Bruce,

thanks for the notice. More efficient methods are welcome.

--bård

Documentation: http://ez.no/doc

Marco Zinn

Monday 03 November 2003 1:37:19 pm

Hi Bard, :)

and please, when someone works on the linkchecker: Don't forget to introduce proxy support or it will be useless for intranet servers.

Marco
http://www.hyperroad-design.com

Paul Borgermans

Monday 03 November 2003 2:03:05 pm

I agree, why not use libcurl for all http outside connections (like for the SOPA module)? It is compatible with the commercial version of ez publish!

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Bruce Morrison

Monday 03 November 2003 2:12:49 pm

I did a quick drop in of the PEAR function and saw considerable speed improvements. Quite important when you have 700+ links to check!

This function allows you to capture the response code which means that you could automatically replace URLs that return a "301 Moved Permanently". Other response codes could be used have a more informative status attached to each link. i.e. a response of 500 is quite different from not being able to connect to the server at all.

In all cases the "Objects which use this link:" drop-down contained "No Object Available" - Is anyone else seeing this?

Proxy support could be added quite easily if the CURL library is used (if installed).

Cheers
Bruce
http://www.designit.com.au/

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish