【发布时间】:2010-12-22 18:35:25
【问题描述】:
我一直在尝试使用 curl 使用 PHP 访问 PayPal 支付授权网站。
例如
... $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $nvp); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $res = curl_exec ($ch); preg_match_all('/Set-Cookie: .*/', $res, $cookieMatches); foreach ($cookieMatches[0] 作为 $cookieMatch) 标头($cookieMatch); preg_match('/Location: .*/', $res, $locMatches); 标头($locMatches[0]); header('Vary: Accept-Encoding'); header('Strict-Transport-Security: max-age=500'); header('传输编码:分块'); header('Content-Type: text/html');原则是简单地反映原始重定向(我相信有一种更简单的方法可以做到这一点)。但是,来自 PayPal 的响应似乎表明某种 cookie 错误。
我的预感是 cookie 已以某种方式链接到原始计算机。谁能证实这一点,或者我只是错过了一些明显的东西!
【问题讨论】: