无法获取查询字符串参数值

时间:2021-07-30 13:13:11

I have integrated sage pay with my wordpress site. I am currently running sagepay in simulator mode.

我已经把sage pay和我的wordpress网站整合在了一起。我目前在模拟器模式下运行sagepay。

After successful payment sagepay redirects to the success page of my site. The redirect url is like this.

付款成功后,sagepay将重定向到我网站的成功页面。重定向url是这样的。

mysite.com/?page_id=632&crypt=@7564ASKJjkkjh....encrypted string.

when i am trying to get query string parameter on my success page by $_REQUEST or $_GET i can only get page_id.

当我试图通过$_REQUEST或$_GET获得成功页面上的查询字符串参数时,我只能获得page_id。

But I can't get 'crypt' parameter.

但是我不能得到'crypt'参数。

I have also tried var_dump($_REQUEST). It also gives only page_id but not crypt parameter.

我还尝试了var_dump($_REQUEST)。它也只提供page_id,而不提供crypt参数。

I wan't to retrieve 'crypt' parameter from query string.

我不会从查询字符串中检索“crypt”参数。

Note: Its working on localhost properly. I got both parameters. But when i uploaded my site on live server, i can get only page_id, but not 'crypt' parameter .

注意:它在本地主机上正常工作。我有两个参数。但是当我在live server上上传我的站点时,我只能获得page_id,而不能获得'crypt'参数。

Any Ideas?

什么好主意吗?

Update: my querystring given by Sage pay is like this:

更新:Sage pay给出的查询字符串如下:

mysite.com/?page_id=632&crypt=@758D2CD31D4B6C192BB70DC99A9F9E1EEAD181E280A3B617E73ACD3E893992E5B9A8A823C3E3B5BE7AF4CEA53C3D12C5C39ECE6F203A2ED76B82711C2E84CFBA1D2574B80F1A53EE4C1D49C60570839F1B1AD4EE83C3D208B943EA9E5F88F94AA3D9F9C2E58F8C7A476787EF8DD438CF8A102AD0D154864291DC02FB8626C177CC02C18F102300AFA0F390841B1C841A2B5A90DB9B1741A46D7AC4C0CA11E90D3C230D5FB6767FAE638A31714FD2C432CB3854162AE49F2C88761C5BAFB92E9ACE354425D9D9801705B088580B9BE113C1319B41893BFC0A2B190F10E8FB5D6EEA779E725D129EE483C631373930BD0F6E6747CD7D79F7AD726D11CB17547D00015CA5793F6E322B8FA0354EAE2DF83A2BD460AB718AC205346EE3E39418B3FBF181B82DB8BC19448F6AC6F48121129F48F2F557F265C5B6A65B23B3FFA516182C7ECA416B6BD9C04E7693744F6133EB4E1989245073FE835D3BA19A8B1EE101

mysite.com/?page_id=632&crypt= @758D2CD31D4B6C192BB70DC99A9F9E1EEAD181E280A3B617E73ACD3E893992E5B9A8A823C3E3B5BE7AF4CEA53C3D12C5C39ECE6F203A2ED76B82711C2E84CFBA1D2574B80F1A53EE4C1D49C60570839F1B1AD4EE83C3D208B943EA9E5F88F94AA3D9F9C2E58F8C7A476787EF8DD438CF8A102AD0D154864291DC02FB8626C177CC02C18F102300AFA0F390841B1C841A2B5A90DB9B1741A46D7AC4C0CA11E90D3C230D5FB6767FAE638A31714FD2C432CB3854162AE49F2C88761C5BAFB92E9ACE354425D9D9801705B088580B9BE113C1319B41893BFC0A2B190F10E8FB5D6EEA779E725D129EE483C631373930 bd0f6e6747cd7d79f7ad726d11cb17547d00015ca5793f6e322b8fa0354eae2df83a2bd460ab718ac205346ee3e39418b3fbf181b82db8bc19448f6ac6f48121129f48f2f557f265c5b6a65b23b3ffa516182c7eca416b6bd9c04e7693744f6133eb4e1989245073fe835d3ba19a8b1ee101

but its works fine on localhost

但它在本地主机上运行良好。

2 个解决方案

#1


4  

Answer

It seems that you are running the Suhosin Security Patch. This patch limits your $_GET parameter to a maximum of 512 bytes.

看起来你在运行Suhosin安全补丁。此补丁将$_GET参数限制为最大512字节。

In order to get around this, you will need to add a value to your php.ini.

为了解决这个问题,您需要为您的ph .ini添加一个值。

suhosin.get.max_value_length = LIMIT_HERE

Reference

Source: http://www.php.net/manual/en/reserved.variables.get.php#101469

来源:http://www.php.net/manual/en/reserved.variables.get.php # 101469

Please note that PHP setups with the suhosin patch installed will have a default limit of 512 characters for get parameters. Although bad practice, most browsers (including IE) supports URLs up to around 2000 characters, while Apache has a default of 8000.

请注意,安装了suhosin补丁的PHP设置对于get参数的默认限制为512个字符。虽然这不是一个好的做法,但是大多数浏览器(包括IE)支持最多2000个字符的url,而Apache的默认值是8000。

To add support for long parameters with suhosin, add suhosin.get.max_value_length = <limit> in php.ini

要使用suhosin添加对长参数的支持,请添加suhosin.get。max_value_length = < php.ini中的限制>

UPDATE 1

更新1

As you do not have access to your php.ini, you will need to change the value in either an .htacess file (if you are using Apache), or alternatively, you may be able to do it using the built in PHP function ini_set().

因为您无法访问php。ini,您将需要更改.htacess文件中的值(如果您使用Apache),或者也可以使用内置的PHP函数ini_set()来完成。

.htacess method:

.htacess方法:

php_value suhosin.get.max_value_length 8000

ini_set method:

报错的方法:

ini_set('suhosin.get.max_value_length', '8000');

However, it is likely (but not certain) that your PHP installation will not allow modification of the Suhosin variables on a per directory basis. In order to fix this, you must request this to be placed into your php.ini, otherwise there is nothing you can do.

但是,您的PHP安装可能不允许在每个目录基础上修改Suhosin变量。为了解决这个问题,您必须请求将其放入php中。ini,否则你什么也做不了。

suhosin.perdir = "p"

#2


3  

I think your production environment have configured filters in php.ini for $_REQUEST, check the filter section of your php.ini, more info: http://www.php.net/manual/en/filter.configuration.php

我认为您的生产环境已经在php中配置了过滤器。对于$_REQUEST,请检查php的筛选器部分。ini,更多信息:http://www.php.net/manual/en/filter.configuration.php

If you don't want to change this configuration on your production environment, you can access the value using filter_input, more info: http://www.php.net/manual/en/function.filter-input.php

如果不希望在生产环境中更改此配置,可以使用filter_input(更多信息)访问该值:http://www.php.net/manual/en/function.filter-input.php

#1


4  

Answer

It seems that you are running the Suhosin Security Patch. This patch limits your $_GET parameter to a maximum of 512 bytes.

看起来你在运行Suhosin安全补丁。此补丁将$_GET参数限制为最大512字节。

In order to get around this, you will need to add a value to your php.ini.

为了解决这个问题,您需要为您的ph .ini添加一个值。

suhosin.get.max_value_length = LIMIT_HERE

Reference

Source: http://www.php.net/manual/en/reserved.variables.get.php#101469

来源:http://www.php.net/manual/en/reserved.variables.get.php # 101469

Please note that PHP setups with the suhosin patch installed will have a default limit of 512 characters for get parameters. Although bad practice, most browsers (including IE) supports URLs up to around 2000 characters, while Apache has a default of 8000.

请注意,安装了suhosin补丁的PHP设置对于get参数的默认限制为512个字符。虽然这不是一个好的做法,但是大多数浏览器(包括IE)支持最多2000个字符的url,而Apache的默认值是8000。

To add support for long parameters with suhosin, add suhosin.get.max_value_length = <limit> in php.ini

要使用suhosin添加对长参数的支持,请添加suhosin.get。max_value_length = < php.ini中的限制>

UPDATE 1

更新1

As you do not have access to your php.ini, you will need to change the value in either an .htacess file (if you are using Apache), or alternatively, you may be able to do it using the built in PHP function ini_set().

因为您无法访问php。ini,您将需要更改.htacess文件中的值(如果您使用Apache),或者也可以使用内置的PHP函数ini_set()来完成。

.htacess method:

.htacess方法:

php_value suhosin.get.max_value_length 8000

ini_set method:

报错的方法:

ini_set('suhosin.get.max_value_length', '8000');

However, it is likely (but not certain) that your PHP installation will not allow modification of the Suhosin variables on a per directory basis. In order to fix this, you must request this to be placed into your php.ini, otherwise there is nothing you can do.

但是,您的PHP安装可能不允许在每个目录基础上修改Suhosin变量。为了解决这个问题,您必须请求将其放入php中。ini,否则你什么也做不了。

suhosin.perdir = "p"

#2


3  

I think your production environment have configured filters in php.ini for $_REQUEST, check the filter section of your php.ini, more info: http://www.php.net/manual/en/filter.configuration.php

我认为您的生产环境已经在php中配置了过滤器。对于$_REQUEST,请检查php的筛选器部分。ini,更多信息:http://www.php.net/manual/en/filter.configuration.php

If you don't want to change this configuration on your production environment, you can access the value using filter_input, more info: http://www.php.net/manual/en/function.filter-input.php

如果不希望在生产环境中更改此配置,可以使用filter_input(更多信息)访问该值:http://www.php.net/manual/en/function.filter-input.php