Welcome Guest, Not a member yet? Register   Sign In
Empty $this->input->get_post in controller whereas $_POST has value at index.php
#1

Hi,

I am facing issue after setting up CodeIgniter 3.1.0 at my server, i.e. I am getting empty $this->input->get_post in my controller but I can get proper $_POST at index.php. Problem is $_POST also become empty in controller. Please guide me. Server is CentOS having plesk.

Best Wishes,
thewonder
Reply
#2

Have you tried $this->input->post() or $this->input->post_get()? I never use get_post() or post_get() myself, but the first step in troubleshooting an issue with either one would be to check the input method that only returns values from the correct array. If it shows up in $this->input->post(), but not $this->input->get_post(), this would imply that $_GET[$index] is set to an empty value.
Reply
#3

Issue turned out to be from Apache's server settings. There were some conditional redirections to automatically move users to https, and once I removed that condition, codeigniter started working fine, web services were able to get post data properly. Although I'll have to find a way for moving users to https if incase they mistakenly use http..
Reply
#4

On one of my sites, I used this in the site's .conf file:

Code:
<VirtualHost *:80>
    ServerName my.server.name
    Redirect 301 / https://myserver.url.here/
</VirtualHost>

Since HTTP and HTTPS are on different ports, configuring port 80 to redirect to HTTPS works pretty well. Of course, this is probably the wrong status code and you probably want to handle things a little more elegantly, but it's a start. This is also intentionally driving all of the traffic to HTTPS, which may not be what you're looking for.

I found that supporting both and ensuring that HTTPS was used everywhere it should be was usually not worth the effort (compared to just pushing as much traffic as possible to HTTPS), and just setting the base URL on the site to use https:// significantly reduced the number of odd issues that would crop up.
Reply
#5

(09-28-2016, 01:49 PM)mwhitney Wrote: On one of my sites, I used this in the site's .conf file:

Code:
<VirtualHost *:80>
   ServerName my.server.name
   Redirect 301 / https://myserver.url.here/
</VirtualHost>

Since HTTP and HTTPS are on different ports, configuring port 80 to redirect to HTTPS works pretty well. Of course, this is probably the wrong status code and you probably want to handle things a little more elegantly, but it's a start. This is also intentionally driving all of the traffic to HTTPS, which may not be what you're looking for.

I found that supporting both and ensuring that HTTPS was used everywhere it should be was usually not worth the effort (compared to just pushing as much traffic as possible to HTTPS), and just setting the base URL on the site to use https:// significantly reduced the number of odd issues that would crop up.

thank you mwhitney Smile
Reply




Theme © iAndrew 2016 - Forum software by © MyBB