安全标头无效

时间:2015-08-13 04:12:25

标签: php post paypal get

我正在尝试在recurring profile

中创建paypal

这是我的代码

<?php

$qs = "";

$username = "xxx";
$password = "xxx";
$signature = "xxx";

$qs = "USER=".$username;
$qs .= "&PWD=".$password;
$qs .= "&SIGNATURE=".$signature;
$qs .= "&METHOD=CreateRecurringPaymentsProfile";
$qs .= "&VERSION=86";
$qs .= "&PAYERID=1";
$qs .= "&PROFILESTARTDATE=2015-08-13T";
$qs .= "&DESC=recurrning payment";
$qs .= "&BILLINGPERIOD=Month";
$qs .= "&BILLINGFREQUENCY=1";
$qs .= "&AMT=10";
$qs .= "&CURRENCYCODE=AUD";
$qs .= "&COUNTRYCODE=AU";
$qs .= "&MAXFAILEDPAYMENTS=3";

header('location:https://api-3t.sandbox.paypal.com/nvp?'.$qs);



?>

从上面的代码中,我收到错误security header is not valid

任何人都可以帮助我

1 个答案:

答案 0 :(得分:0)

在网址中使用%20代替space (' ')可能有助于您解决错误[虽然我不确定]:

<?php
$qs = "";

$username = "xxx";
$password = "xxx";
$signature = "xxx";

$qs = "USER=".$username;
$qs .= "&PWD=".$password;
$qs .= "&SIGNATURE=".$signature;
$qs .= "&METHOD=CreateRecurringPaymentsProfile";
$qs .= "&VERSION=86";
$qs .= "&PAYERID=1";
$qs .= "&PROFILESTARTDATE=2015-08-13T";
$qs .= "&DESC=recurrning%20payment";//replace the space
$qs .= "&BILLINGPERIOD=Month";
$qs .= "&BILLINGFREQUENCY=1";
$qs .= "&AMT=10";
$qs .= "&CURRENCYCODE=AUD";
$qs .= "&COUNTRYCODE=AU";
$qs .= "&MAXFAILEDPAYMENTS=3";

header('location:https://api-3t.sandbox.paypal.com/nvp?'.$qs);
?>