How to Checking a URL :Valid or Invalid

Discussion in 'C++' started by Rasheed, Jul 30, 2007.

  1. Rasheed

    Rasheed Guest

    Hi All,
    Could any body help me. Regarding how to check a URL is
    Valid or
    Invalid.
    I am using Four functions to check the same.
    1) hConnect = WinHttpConnect( hSession, "www.google.co.in",
    INTERNET_DEFAULT_HTTPS_PORT, 0);
    2) hRequest = WinHttpOpenRequest( hConnect,
    "{GET}",
    pUrl, /// "/sea123rch?
    hl=en&q=flow123ers&meta="
    NULL,
    WINHTTP_NO_REFERER,
    WINHTTP_DEFAULT_ACCEPT_TYPES,
    WINHTTP_FLAG_BYPASS_PROXY_CACHE );
    3) bResults = WinHttpSendRequest( hRequest,
    WINHTTP_NO_ADDITIONAL_HEADERS, 0,
    WINHTTP_NO_REQUEST_DATA, 0,
    0, 0 );
    4) bResults = WinHttpReceiveResponse( hRequest, NULL );

    Here is my observation when I have given the wrong URL in
    WinHttpOpenRequest(..pUrl..), it has to throw the
    ERROR_WINHTTP_INVALID_URL or at least WinHttpSendRequest() has to
    thorw the Exception but I haven't getting this.


    Would I have to set any flag to check URL is valid or not please if
    any Sample code would be good.


    Can any body please help me out to sort out this problem.


    Here is the example for Valid and Invalid URL:


    Valid URL:
    http://www.google.co.in/search?hl=en&q=flowers&meta=


    Invalid URL:
    http://www.google.co.in/sea123rch?hl=en&q=flow123ers&meta=


    Regards,
    Rs.
     
    Rasheed, Jul 30, 2007
    #1
    1. Advertising

  2. * Rasheed:
    > [off-topic]


    Your question is not about the C++ language. Please post in some
    appropriate group. The FAQ lists some possibly appropriate groups.

    Hth.,

    - Alf

    --
    A: Because it messes up the order in which people normally read text.
    Q: Why is it such a bad thing?
    A: Top-posting.
    Q: What is the most annoying thing on usenet and in e-mail?
     
    Alf P. Steinbach, Jul 30, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex

    checking valid filename

    Alex, Jan 31, 2004, in forum: Java
    Replies:
    8
    Views:
    13,073
    Jon A. Cruz
    Feb 8, 2004
  2. Berlin  Brown
    Replies:
    3
    Views:
    1,247
    Berlin Brown
    Jul 1, 2005
  3. Martin Drautzburg

    wxTreeCtrl checking for valid IDs

    Martin Drautzburg, Dec 27, 2004, in forum: Python
    Replies:
    0
    Views:
    427
    Martin Drautzburg
    Dec 27, 2004
  4. Replies:
    0
    Views:
    481
  5. Rudi Ahlers
    Replies:
    11
    Views:
    846
    Aaron Bertrand [MVP]
    Apr 11, 2004
Loading...

Share This Page