Jump to content

¶ should be &: I don't know what's wrong


peterhuynh

Recommended Posts

Here is an example of what the "code" should look like:

tonce=1377743828095093
&accesskey=1d87effa-e84d-48c1-a172-0232b86305dd
&requestmethod=post
&id=1
&method=buyOrder
&params=500,1

This is what I get:

tonce=1434662836898942
&accesskey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
&requestmethod=post
&id=1
&method=buyOrder
¶ms=

Notice that the '&' sign has changed into a '¶', and 'params' is changed into 'ms', and it deson't recognize the parameters I put into the code.

 

Any idea why this is?

 

Link to comment
Share on other sites

without knowing where and how this is being produced, where and how you are viewing the incorrect value, and what sort of processing might be occurring between those two points, it's impossible to tell.

 

could be due to a programming problem changing the value or copy/pasting part for that value from somewhere that has some character encoding that looked correct where it was copied from, but isn't actually the charters they appeared to be or some type of  character encoding issue with the method you are using to view the value.

Link to comment
Share on other sites

To expand on what mac_gyver said.

 

Is hard for us to tell where this data is coming from in the first place.

 

If it's a matter of displaying the output in html can use htmlentities()

$parameters = "tonce=1377743828095093
&accesskey=1d87effa-e84d-48c1-a172-0232b86305dd
&requestmethod=post
&id=1
&method=buyOrder
&params=500,1";

echo htmlentities($parameters, ENT_QUOTES, "UTF-8");

& should actually be & or encoded %26 or %26amp%3B so there is no confusion to the browser output, it's just parsing by it's rules

 

To prevent this you can encode and decode data that's expected to go through the address bar

urlencode()

urldecode()

rawurlencode()

rawurldecode();

 

Since it seems you are combining parameters for use in the address bar should try http_build_query()

 

As an example from an array:

$parameters = array("tonce"=>"1377743828095093","accesskey"=>"1d87effa-e84d-48c1-a172-0232b86305dd","requestmethod"=>"post","id"=>"1","method"=>"buyOrder","params"=>"500,1");

echo http_build_query($parameters, '', '&');

results:

tonce=1377743828095093&accesskey=1d87effa-e84d-48c1-a172-0232b86305dd&requestmethod=post&id=1&method=buyOrder&params=500%2C1

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.