URL checker

This is a discussion on URL checker within the C++ Programming forums, part of the General Programming Boards category; Hi there, Do you have any ideas about how to construct a simple URL checker ? Not one that actually ...

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    29

    Question URL checker

    Hi there,

    Do you have any ideas about how to construct a simple URL checker ? Not one that actually checks server side to see whether or not the domain name actually exists.

    User must enter something like www.domain_name.com

    At its simplest level is it sufficient to check that two periods have been etered ?

    I am not looking for source code !




    regards,

    bigSteve
    bigSteve

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,485
    Tricky, this is valid and only has one dot
    http://motherboards.org/
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    hmmmmm regular expression comes to my mind...

  4. #4
    Perverted unanimous's Avatar
    Join Date
    Oct 2001
    Posts
    336
    Doesn't the boost library have a regex library? An english teacher at my school who progams has been telling me all year to learn regular expressions, they do seem to come in handy.
    Give me a bad reputation!!!

  5. #5
    Registered User
    Join Date
    Feb 2002
    Posts
    29

    URL checker

    unanimous replied:

    Doesn't the boost library have a regex library?

    What does this sentence mean ?


    bigSteve
    bigSteve

  6. #6
    Perverted unanimous's Avatar
    Join Date
    Oct 2001
    Posts
    336
    Boost is a C++ library located at Boost.org. Its a very good andvery useful library and the creators are trying to make it part of the new C++ standards if I remember correctly. Regex is the abbreciated form of regular expressions which vasanth mentioned earlier.
    Give me a bad reputation!!!

  7. #7
    Registered User Russell's Avatar
    Join Date
    May 2004
    Posts
    71
    Checking for two periods is redundant, since sub-domains (which www is) don't validate domain names.

    I guess, logically, it might be done as such:
    - Locate the end of the TLD (which would be either a forward-slash (domain.com/index.html), or nothing (domain.com));
    - Check every character up-until is valid (i.e. no spaces, etc.);

  8. #8
    Registered User
    Join Date
    Feb 2002
    Posts
    29
    Thanks for all your suggestions,

    bigSteve
    bigSteve

  9. #9
    Registered User BillBoeBaggins's Avatar
    Join Date
    Oct 2003
    Posts
    107
    Well this on another wave length then what you were going for, but if you have an active connection and wanted to see if the URL was valid, try making a connection to it, not visible mind you... and then check the host response.. kinda like using sockets...

    Safe Coding...

  10. #10
    Registered User Russell's Avatar
    Join Date
    May 2004
    Posts
    71
    It would be far quicker and resource friendly to check for invalid characters prior to resolving.

  11. #11
    Registered User BillBoeBaggins's Avatar
    Join Date
    Oct 2003
    Posts
    107
    Yhea your correct it would not be friendly, but it is the only true way to make sure a URL is valid. But if you just want to check URL syntax then you can.. It was an idea... not a perfect resolution.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. URL escape issue
    By George2 in forum C# Programming
    Replies: 2
    Last Post: 08-12-2008, 11:45 AM
  2. Interpreter.c
    By moussa in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 05:59 PM
  3. Replies: 1
    Last Post: 07-02-2007, 09:22 AM
  4. Url query encoding/decoding
    By Niara in forum Networking/Device Communication
    Replies: 6
    Last Post: 04-25-2007, 03:30 PM
  5. how to rotate url randomly?
    By Antipher in forum Tech Board
    Replies: 3
    Last Post: 03-21-2003, 01:34 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21