简体   繁体   中英

Background process to get 404 error in php

I have an online shop that gives me randomly 404 error on product page, but I don't know when. It is possible to get this error one time in a week or 2-3 times in a day, it is very random. I found on the internet what could be the problem, but I cannot check if the problem is solved only if I wait a few days to see if I get the error again.

It is possible to make a background process that will run every 30 seconds or less and accessing randomly a product page and if it gets the 404 error, writes in a error.txt file when that happened?

I'm asking this because I don't know if this can be done because I never try to access some pages in background. Can anyone give me some suggestions or ideas? Thank you!

EDIT: I forgot to specify that I'm using Windows 10.

You can monitor it using wireshark and use filters, something like:

http.response.code == 404

refer to this:

https://osqa-ask.wireshark.org/questions/27616/follow-http-redirects-automatically-http-status-codes-301302

This way you get them all and not just an estimation.

-edit:

You can also do cron job with curl emulating a userer to catalyze the test and you can use it alone and log the response status if it is 404 and you better do it from another server and much better on another machine and you can even do somthing like android app using that do the request with a service, just go with what you knew better

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM