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

[eluser]jmadsen[/eluser]
man, I am stumped, and you probably won't be able to help, but perhaps if I talk it through here:


I am troubleshooting a custom cms someone else wrote; specifically, one of the payment gateways (HSBC - similar type library as PayPal or the like, but using Curl )


It has a callback function from the bank's site, returning a set of $_POST variables.

PROBLEM: The $_POST variable are not accessible from app's controller (I can see them returned by using httpFox)

I CAN:

1) return to a non-app .php page and print_r($_POST) (i.e., callback url is just another page on my server, outside of CI)

2) post a Form from within or outside the app to the suspect controller, and print_r($_POST) with no trouble (i.e., this controller/app CAN receive a normal post)

So, trying to read the $_POST results from the callback itself is what is failing.

Any ideas on what to check, or how to track this? It's obviously some setting somewhere, perhaps with Curl, but I'm at a loss

TIA,

jeff
#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);
#3

[eluser]weboap[/eluser]
most likely its the CI csrf causing your problem, turn it off and try.

Code:
$data = $this->input->post();
var_dump($data);




Theme © iAndrew 2016 - Forum software by © MyBB