Sign in to follow this  
ArchG

Detecting 404 errors, redirects, and other errors with Winsock

Recommended Posts

Hello again everyone! I'm trying to do exactly what the title says. Kindof like making a link verifyier..that will scan text files (html, asp, or other webpage docs) pick up links and test them and get the results..like if it's redirected somewhere..grab where it's being redirected and give me the option to change it..and stuff like that If anyone can point in the right direction, that would be awesome Oh, and also, if you're gunna just direct me to [google], give me some search strings! I can't find anything to do with this topic no matter what I search for. Thanks P.S I'd like to use C++ on this project, but if you know of a library in another language that works great for this sorta thing (better than a c++ lib) don't be hesitant to shout it out.

Share this post


Link to post
Share on other sites
You basically have to implement part of the HTTP protocol. Connect, transfer a request ("get whatever"), see what you recieve, check it for 404s (it should have the number 404 in it), redirects (whatever the HTTP code is for it) and meta-redirects (scan the HTML file and look for meta tags).

Google for stuff on HTTP.

For a pre-built solution this may be useful.

Share this post


Link to post
Share on other sites
The error code is in the very first line the server sends to you after you've sent it your request.

HTTP/<version> <error number> <reason>

Example:

HTTP/1.1 200 OK or HTTP/1.1 404 Not Found

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this