PHP URL encoding retaining invalid url characters

Posted by Keyo on Stack Overflow See other posts from Stack Overflow or by Keyo
Published on 2010-06-11T04:43:50Z Indexed on 2010/06/11 4:52 UTC
Read the original article Hit count: 286

Filed under:
|

I need to replace url invalid characters with something url valid then convert it back again.

This is for a search page with a url like http://my.site/search/this-is-a-search, the search form POSTS then the user redirected to the new url.

Php has functions urlencode and urldecode however these do not work at all, and leave invalid characters in my url.

Surely I don't need to reinvent the wheel here.

© Stack Overflow or respective owner

Related posts about php

Related posts about http