Reputation: 70466
I have a problem with producing valid urls from strings. E.g.:
"http://mysite.de/go/".$text
I want to add text, might be a title, to the link. The script behind go/ takes the title, gets the ID of the post, uses the ID to get an url from the database to execute it. This works for e.g.
$text = "zalando.de"
But for
$text = "1&1 Email"
it does not work. S I think I have to encode $text to make it valid? Is there a standart method to do that?
Upvotes: 0
Views: 2602
Reputation: 655835
Use rawurlencode
to encode the string properly:
"http://mysite.de/go/".rawurlencode($text)
Upvotes: 3