Using CURL - help sending and redirecting

I have been banging my head on the wall for several hours - and this is probably something really obvious that I missed!

I am trying to connect to a payment service provider (PSP) using CURL, send data and monitor the message so that the user really gets to the PSP website.

Using the following:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://psp.com/theirpage');
curl_setopt($ch, CURLOPT_REFERER,  "http://mysite.com/mypage");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
curl_setopt($ch, CURLOPT_POST, 1);
$result=curl_exec($ch);
curl_close($ch);

This successfully connects, validates the data that I transferred, but instead of redirecting the user to the PSP, it just loads the HTML on my site. Safe mode is turned off, and open_basedir is empty.

What am I doing wrong?

+3
source share
2 answers

CURL , , curl script. , , , . cURL ' .

, cURL, header() JS, window.location.

0

curl , . . HTML- ( ), Javascript. ,

0

All Articles