Skip to content

Use this php function to return URLs sanitized for database insertion. Works for all the sample URLs I've thrown at it so far, including #! urls like you see on twitter.

Notifications You must be signed in to change notification settings

timmahoney/Sanitize-URLs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Function: sanitize_urls
Author: Tim  Mahoney
Author URI: http://www.timothymahoney.com

Use this function to make URLs more standard for insertion into your database. 
That way, when you search, you can ensure standardization.

Adds http (or whatever you feel like using as a default) to the beginning
Adds www to anything without a subdomain

Fully PHP 4 / PHP 5 compatible 

URLs I've tested:
http://www.google.com
http://www.google.com/
http://www.bbc.co.uk/news/world/us_and_canada/
http://localhost/subfolder/some_page.php?variable=value&something=value2#fragmenthere=somethingelse

About

Use this php function to return URLs sanitized for database insertion. Works for all the sample URLs I've thrown at it so far, including #! urls like you see on twitter.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published