0

I'm attempting to encode the following using urlencode:

 <t:RequestSecurityTokenResponse xmlns:t 

which should be encoded as:

 %3Ct%3ARequestSecurityTokenResponse+xmlns%3At 

However, the result of urlencode is this:

 %26lt%3Bt%3ARequestSecurityTokenResponse+xmlns%3At

I feel like I'm missing something extremely obvious here, but I haven't been able to figure it out. Any suggestions?

1

1 Answer 1

1

The front of your encoded string looks like the html entity for <. It appears what you are passing to urlencode has been run through htmlentities.

php > echo urlencode("<t:RequestSecurityTokenResponse xmlns:t");
%3Ct%3ARequestSecurityTokenResponse+xmlns%3At
php > echo urlencode("&lt;t:RequestSecurityTokenResponse xmlns:t");
%26lt%3Bt%3ARequestSecurityTokenResponse+xmlns%3At
Sign up to request clarification or add additional context in comments.

1 Comment

That was it...thanks. The string I was converting was from a cURL response, and instead of writing it to a file I was viewing it in a browser with var_dump, making the HTML entities appear as their actual characters. I knew it was something simple. Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.