Paypal IPN 中的重音 returns 无效
Accents in Paypal IPN returns INVALID
我有一个问题:
我正在 PHP 中创建一个 Paypal IPN 服务器。我用 IPN 模拟器触发它,效果很好。问题是当我在某些领域引入口音时(我来自西班牙裔县),它 returns 无效!我尝试使用 urlencode 和 htmlentities(不在一起)对 $value var(您可能会看到理解它的代码)进行编码,但它不起作用。你知道我能做什么吗?
至少说一下我是否需要担心。
<?php
//$url='https://www.paypal.com/cgi-bin/webscr';
$url='https://www.sandbox.paypal.com/cgi-bin/webscr';
$postFields = 'cmd=_notify-validate';
foreach($_POST as $key => $value){
$postFields .= "&$key=$value";
}
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $postFields
));
$result=curl_exec($ch);
curl_close($ch);
$fh=fopen('result.txt', 'w');
fwrite($fh, $result.' -- '.$postFields);
fclose($fh);
echo $result;
?>
我终于找到了有效的方法(只是在现场,而不是沙盒):
If the customer name, or address has accented characters and they do not appear correctly on your site after the user has purchased something then chances are the IPN from paypal was not in UTF-8 format.
To set this log into your paypal account.
Then after logging in go to this page:
https://www.paypal.com/ie/cgi-bin/webscr?cmd=_profile-language-encoding
After going to that page click on "more option" just below the input
box.
Then for your websites encoding option (encoding selection box)
select "utf-8" from the drop down.
Then in the next setting leave it
set to "yes" and hit "save". That should correct the issue.
来源:http://www.ktools.net/photostore/documentation.php?fid=276
我有一个问题:
我正在 PHP 中创建一个 Paypal IPN 服务器。我用 IPN 模拟器触发它,效果很好。问题是当我在某些领域引入口音时(我来自西班牙裔县),它 returns 无效!我尝试使用 urlencode 和 htmlentities(不在一起)对 $value var(您可能会看到理解它的代码)进行编码,但它不起作用。你知道我能做什么吗?
至少说一下我是否需要担心。
<?php
//$url='https://www.paypal.com/cgi-bin/webscr';
$url='https://www.sandbox.paypal.com/cgi-bin/webscr';
$postFields = 'cmd=_notify-validate';
foreach($_POST as $key => $value){
$postFields .= "&$key=$value";
}
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $postFields
));
$result=curl_exec($ch);
curl_close($ch);
$fh=fopen('result.txt', 'w');
fwrite($fh, $result.' -- '.$postFields);
fclose($fh);
echo $result;
?>
我终于找到了有效的方法(只是在现场,而不是沙盒):
If the customer name, or address has accented characters and they do not appear correctly on your site after the user has purchased something then chances are the IPN from paypal was not in UTF-8 format.
To set this log into your paypal account.
Then after logging in go to this page:
https://www.paypal.com/ie/cgi-bin/webscr?cmd=_profile-language-encodingAfter going to that page click on "more option" just below the input box.
Then for your websites encoding option (encoding selection box) select "utf-8" from the drop down.
Then in the next setting leave it set to "yes" and hit "save". That should correct the issue.
来源:http://www.ktools.net/photostore/documentation.php?fid=276