HongPong / broken-link-checker

This plugin will check your posts, comments and other content for broken links and missing images, and notify you if any are found. (non-commercial community fork of broken-link-checker)
10 stars 4 forks source link

Cookie support #38

Open grzegorz-janoszka opened 5 years ago

grzegorz-janoszka commented 5 years ago

Hi, This plugin doesn't like redirect with cookies.

Just add to your site a few links like: http://physrev.physiology.org/content/81/3/1031.full http://www.fasebj.org/content/25/1_Supplement/528.2 https://www.nature.com/articles/pr201551

There is a quick fix to get rid of some of those errors. In the file broken-link-checker/modules/checkers/http.php around line 200 add another parameter to CURL:

curl_setopt($ch, CURLOPT_COOKIEFILE, "");

This causes curl to accept cookies and to store them temporarily in the memory. That is fine and it is enough.

It solves some issues, the problem remains with some links and their logic. Because BLC reports me as a redirect link which eventually gets redirected to itself. I think there has to be a check if the final url equals the original url, then there is nothing to report and it is not a redirect, despite there are different url's in between (for example to set cookies).

I will try to to add this logic to BLC a little bit later.