Jump to content


Photo

PHP to Strip All Characters Not Allowed in URL


  • Please log in to reply
1 reply to this topic

#1 casbboy

casbboy
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 05 June 2006 - 10:06 PM

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?

Thanks
Ryan

Again, thanks for all the help I recieve

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 06 June 2006 - 12:28 AM

[!--quoteo(post=380391:date=Jun 5 2006, 10:06 PM:name=casbboy)--][div class=\'quotetop\']QUOTE(casbboy @ Jun 5 2006, 10:06 PM) View Post[/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?

Thanks
Ryan
[/quote]

Try str_replace or try eregi

webaddress="www.[]'^mydomain.com";
webresult=str_repalce("[]\'\^\","",$webaddress);

echo $webresult;
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users