0

When I said simple string It works fine, but when I send my public_key string in the same way, It shows error.

I have tried the urlencode() method.

<iframe src="http://local.abc.com/formulaList?id=<?php echo $public_key; ?>" > 

2 Answers 2

2

base64() doesn't work because its output can contain slashes (and anyway, most public key strings are already base64 encoded)

htmlspecialchars() escapes HTML special chars as its name implies which has nothing to do with urls (for example, é will be converted to &eacute;)

urlencode() is the right function to use but keep in mind an URL shouldn't be too long as explained in this SO answer

What problem did you encounter when using urlencode() ?

Sign up to request clarification or add additional context in comments.

Comments

-2

I write something this might work.

$url = htmlspecialchars("wdsd@ccddsd*"); header("Location: https://www.google.com?key={$url}"); 

this will work for you!

2 Comments

htmlspecialchars is for escaping HTML ... special chars such as "à", "é", "è", "~", "ô", etc...
But it working when Header() Load it. You can copy and check results on your side.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.