dongyong1400 2015-05-15 08:34
浏览 34
已采纳

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?

  • 写回答

1条回答 默认 最新

  • dongque4778 2015-05-15 08:39
    关注

    You have to use urldecode() function for it.

    For example :

    $data = "mymail%40gmail%2ecom";
    echo urldecode($data);
    

    Output :

    mymail@gmail.com

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法