casbboy Posted June 5, 2006 Share Posted June 5, 2006 I have a mod-rewrite working that puts the title of an article into an html looking page like so.[a href=\"http://www.sample.com/name-of-file.html\" target=\"_blank\"]http://www.sample.com/name-of-file.html[/a]I want to make sure that characters not allowed in the URL don't make it in there.Is there a PHP function that removes everything that typically isn't allowed in an URL address?such as ( ) " ' html tags carrots and more?ThanksRyan Quote Link to comment https://forums.phpfreaks.com/topic/11274-php-to-strip-all-characters-not-allowed-in-url/ Share on other sites More sharing options...
redarrow Posted June 6, 2006 Share Posted June 6, 2006 [!--quoteo(post=380391:date=Jun 5 2006, 10:06 PM:name=casbboy)--][div class=\'quotetop\']QUOTE(casbboy @ Jun 5 2006, 10:06 PM) [snapback]380391[/snapback][/div][div class=\'quotemain\'][!--quotec--]I have a mod-rewrite working that puts the title of an article into an html looking page like so.[a href=\"http://www.sample.com/name-of-file.html\" target=\"_blank\"]http://www.sample.com/name-of-file.html[/a]I want to make sure that characters not allowed in the URL don't make it in there.Is there a PHP function that removes everything that typically isn't allowed in an URL address?such as ( ) " ' html tags carrots and more?ThanksRyan[/quote]Try str_replace or try eregiwebaddress="www.[]'^mydomain.com";webresult=str_repalce("[]\'\^\","",$webaddress);echo $webresult; Quote Link to comment https://forums.phpfreaks.com/topic/11274-php-to-strip-all-characters-not-allowed-in-url/#findComment-42243 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.