I have been experimenting with curl for accessing the PayPal payment authorisation site using PHP.
e.g.
... $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] as $cookieMatch) header($cookieMatch); preg_match('/Location: .*/', $res, $locMatches); header($locMatches[0]); header('Vary: Accept-Encoding'); header('Strict-Transport-Security: max-age=500'); header('Transfer-Encoding: chunked'); header('Content-Type: text/html');
The principle being simply to reflect the original redirect (I am sure there is a simpler way to do this). However, the response from PayPal seems to indicate some kind of cookie error.
My hunch is that the cookie has been linked to the originating machine in some way. Can anyone confirm this, or am I just missing something obvious!