CodeIgniter Forums
callback post vars "disappearing" - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: callback post vars "disappearing" (/thread-45791.html)

callback post vars "disappearing" - El Forum - 10-05-2011

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)


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



callback post vars "disappearing" - El Forum - 05-12-2012

[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:

//open connection
$ch = curl_init();

$fields = array(

//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

callback post vars "disappearing" - El Forum - 05-12-2012

most likely its the CI csrf causing your problem, turn it off and try.

$data = $this->input->post();