I've been tasked with going through a database and checking all of the links, on a weekly schedule. I normally work in PHP, but doing this in PHP would be very slow (it actually would timeout the page after about 100 URLs), so I decided to make a quick C++ app.
Admitidly, I haven't used C++ since college, so I'm a bit rusty.
I found the ShellExecute function, and that it would open the page no problem. Here is what I have so far:
#include <shlobj.h>
#include <iostream>
using namespace std;
int main()
{
if( ShellExecute(NULL,"find","http://example.com/fdafdafda.php",NULL,NULL,SW_SHOWDEFAULT) )
{
cout << "Yes";
} else {
cout << "No";
}
cout << endl;
system("PAUSE");
return 0;
}
The problem is that it always returns true, whether it is opening a valid page or not. It appears to be checking if the associated app (a browser in this case) is able to open the document with no problems, then returns true. It isn't looking to see if the browser is getting a 404 or not, it simply sees it open and run and is fine.
Is there a better way to do this? Am I missing a step?
As an aside, I have attempted to use the cURLcpp stuff, but can't seem to figure it out. All of the examples point to header files that don't exist in the download. I have a feeling cURLcpp is the better way to do this.
Thanks for any help.