PHP - 将从paypal发送的数据解码为友好的可读格式
I have a basic php paypal script that works fine (I'm working on sandbox)
my issue is the response I get from paypal is unreadable and cannot therefore be use to do what I want i.e update my database
here's what I'm getting:
Array
(
[TOKEN] => EC%xxxxx0T
[BILLINGAGREEMENTACCEPTEDSTATUS] => 0
[CHECKOUTSTATUS] => PaymentActionCompleted
[TIMESTAMP] => 2015%2d05%2d15T08%3a23%3a58Z
[ACK] => Success
[VERSION] => 109%2e0
[BUILD] => 16684246
[EMAIL] => mymail%40gmail%2ecom
[PAYERSTATUS] => verified
[FIRSTNAME] => myfname
[LASTNAME] => mylname
[COUNTRYCODE] => US
[SHIPTONAME] => fname%20lname
[SHIPTOSTREET] => 1%20Main%20St
[SHIPTOCITY] => San%20Jose
[SHIPTOSTATE] => CA
[SHIPTOZIP] => 95131
[SHIPTOCOUNTRYCODE] => US
[SHIPTOCOUNTRYNAME] => United%20States
[ADDRESSSTATUS] => Confirmed
[CURRENCYCODE] => USD
[AMT] => 96%2e00
.........
As shown I'm getting the above response so for instance, I cannot store the timestamp in the database in such format: [TIMESTAMP] => 2015%2d05%2d15T08%3a23%3a58Z or email like this: [EMAIL] => mymail%40gmail%2ecom
I've tried using utf8 like so:
header('Content-Type: text/html; charset=utf-8');
but it doesn't seem to help
How can I decode the response I'm receiving from paypal into friendly readable format?
我有一个基本的PHP paypal脚本,工作正常(我在沙盒上工作) p>
我的问题是我从paypal获得的响应是不可读的,因此不能用于做我想要的事情,即更新我的数据库 p>
这里是我得到的: p>
数组
(
[TOKEN] => EC%xxxxx0T
[BILLINGAGREEMENTACCEPTEDSTATUS] => 0
[CHECKOUTSTATUS] => PaymentActionCompleted
[TIMESTAMP] => 2015%2d05%2d15T08%3a23%3a58Z
[ACK] =>成功
[版本] => 109%2e0
[BUILD] => 16684246
[EMAIL] => mymail %40gmail%2ecom
[PAYERSTATUS] =>已验证
[FIRSTNAME] => myfname
[LASTNAME] => mylname
[COUNTRYCODE] =>美国
[SHIPTONAME] => fname% 20lname
[SHIPTOSTREET] => 1%20Main%20St
[SHIPTOCITY] => San%20Jose
[SHIPTOSTATE] => CA
[SHIPTOZIP] => 95131
[SHIPTOCOUNTRYCODE] =&gt ; US
[SHIPTOCOUNTRYNAME] => United%20States
[ADDRESSSTATUS] => 确认
[CURRENCYCODE] => USD
[AMT] => 96%2e00
.........
code> pre>
如图所示,我得到了上述响应,例如,我无法存储时间戳 这种格式的数据库: [TIMESTAMP] => 2015%2d05%2d15T08%3a23%3a58Z strong>或这样的电子邮件: [EMAIL] => mymail%40gmail%2ecom strong> p>
我尝试过像这样使用utf8: p>
header('Content-Type: text / html; charset = utf-8');
code> pre>
但它似乎没有帮助 p>
怎么能 我将从paypal收到的响应解码为友好的可读格式? p>
div>
You have to use urldecode()
function for it.
For example :
$data = "mymail%40gmail%2ecom";
echo urldecode($data);
Output :
mymail@gmail.com