Welcome Guest, Not a member yet? Register   Sign In
callback post vars "disappearing"
#2

[eluser]The Questioner[/eluser]
I had to do something similar with the Barclaycard payment gateway. I used the following code to populate an array with the POST variables (sending the POST array directly doesn't seem to work), and then used CURL to POST it to my CI controller:

Code:
//open connection
$ch = curl_init();

$fields = array(
  'transactionstatus'=>strip_tags($_POST['transactionstatus']),
  'total'=>strip_tags($_POST['total']),
  'clientid'=>strip_tags($_POST['clientid']),
  'oid'=>strip_tags($_POST['oid']),
  'datetime'=>strip_tags($_POST['datetime']),
  'chargetype'=>strip_tags($_POST['chargetype']),
  'ecistatus'=>strip_tags($_POST['ecistatus']),
  'cardprefix'=>strip_tags($_POST['cardprefix']),
  'status'=>strip_tags($_POST['status'])  
  );  

//set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POST,count($fields));
//curl_setopt($ch, CURLOPT_USERPWD, 'admin:mduk'); //only include this if you have htaccess applied across whole site
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);

//execute post
$result = curl_exec($ch);

//close connection
curl_close($ch);


Messages In This Thread
callback post vars "disappearing" - by El Forum - 10-05-2011, 08:06 PM
callback post vars "disappearing" - by El Forum - 05-12-2012, 08:47 AM
callback post vars "disappearing" - by El Forum - 05-12-2012, 11:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB