First of all, check if your action is working fine and give the expected behavior if you call it from the URL.
I have the following setup with ci3.
Hosts
$ cat /etc/hosts
127.0.0.1 ci3.local
Available Apache Sites
cat /etc/apache2/sites-available/ci3.conf
<VirtualHost *:80>
ServerAdmin email@email.com
ServerName ci3.local
DocumentRoot /home/user/project/ci3
ErrorLog ${APACHE_LOG_DIR}/ci3_error.log
CustomLog ${APACHE_LOG_DIR}/ci3_access.log combined
SetEnv APPLICATION_ENV "development"
<Directory /home/user/project/ci3>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Allow from all
</Directory>
</VirtualHost>
CI3 / .htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
CI3 / application / Config / routes.php
$route['billing/success'] = 'billing/success';
CI3 / application / controllers / Billing.php
<?php
class Billing extends CI_Controller {
public function success()
{
log_message('debug', 'Billing.success');
log_message('debug', $this->input->post('amount'));
}
}
, http://ci3.local/billing/success ,
DEBUG - 2015-12-07 08:47:34 --> UTF-8 Support Enabled
DEBUG - 2015-12-07 08:47:34 --> Global POST, GET and COOKIE data sanitized
DEBUG - 2015-12-07 08:47:34 --> Billing.success
DEBUG - 2015-12-07 08:47:34 -->
DEBUG - 2015-12-07 08:47:34 --> Total execution time: 0.0019
, ?
$ curl --data "amount=200" http:
,
DEBUG - 2015-12-07 08:49:38 --> UTF-8 Support Enabled
DEBUG - 2015-12-07 08:49:38 --> Global POST, GET and COOKIE data sanitized
DEBUG - 2015-12-07 08:49:38 --> Billing.success
DEBUG - 2015-12-07 08:49:38 --> 200
DEBUG - 2015-12-07 08:49:38 --> Total execution time: 0.0021
CURL http?
CI3/curl.php
<?php
$ch = curl_init();
$curlConfig = array(
CURLOPT_URL => "http://ci3.local/billing/success",
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => array(
'amount' => '300'
)
);
curl_setopt_array($ch, $curlConfig);
$result = curl_exec($ch);
curl_close($ch);
curl.php
php5 curl.php
,
DEBUG - 2015-12-07 08:53:41 --> UTF-8 Support Enabled
DEBUG - 2015-12-07 08:53:41 --> Global POST, GET and COOKIE data sanitized
DEBUG - 2015-12-07 08:53:41 --> Billing.success
DEBUG - 2015-12-07 08:53:41 --> 300
DEBUG - 2015-12-07 08:53:41 --> Total execution time: 0.0021