Jump to content

Recommended Posts

It's pretty annoying to determine a url without http://www., you would end up getting things that aren't urls like asdf.asdf, unless you're very specific about the domain extensions (.com, .net, etc) and you would inevitably leave out some other less common ones like .tc. Not to mention you could run into the problematic ones such as .co.uk. Why not require www. or http:// to match?

 

Google "url regular expression" there are thousands out there.

Link to comment
https://forums.phpfreaks.com/topic/128306-solved-question/#findComment-664650
Share on other sites

well now I am a bit lost, I used those keywords you suggested, and I found something like this:

 

^((ht|f)tp(s?)\:\/\/|~/|/)?([\w]+:\w+@)?([a-zA-Z]{1}([\w\-]+\.)+([\w]{2,5}))(:[\d]{1,5})?((/?\w+/)+|/?)(\w+\.[\w]{3,4})?((\?\w+=\w+)?(&\w+=\w+)*)?

 

How do I use this to determined if a string is a url?

Link to comment
https://forums.phpfreaks.com/topic/128306-solved-question/#findComment-664653
Share on other sites

Well Zanus, that is a good idea!

 

I have this script I have been working on for days, and almost a week now, and I am pretty sure if you did a search on this website with the keywords ELC, or External Link Checker, you would find numerous results with topics by me. That being said, I am encrypting the get url values, after they have been pinged, and they turn out valid, then I am  adding them to the database, then checking to see if it blacklisted or not, well in order to check to see if the string is already encrypted I need to see if it is a url! Well if I go ahead and add http:// to the string I would get something like this http://f051adfaf5d5d0d1, so if a users puts in, lets say, phpfreaks.com, I need to determined that this is a valid link, but how?

Link to comment
https://forums.phpfreaks.com/topic/128306-solved-question/#findComment-664664
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.