views:

82

answers:

1

I have a link. I have checked that the link is a valid URL through regular expressions. Now, I want to check if the link is a valid http link or not. i.e. it should not be a non-existing link. Is there a way in VC++ 6.0 (MFC) to check that?

+3  A: 

One option is to try to get data from that URL by using the URLOpenBlockingStream function.

Example:

IStream*    pStream = NULL;

URLOpenBlockingStream(0, "URL string", &pStream, 0, 0);

if (!pStream) return FALSE;

pStream->Release(); // <-- release it immediately, we don't need the data

return TRUE;
Nick D
Thanks a lot.It helped me a lot
Varun Mahajan