Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
Lost POST data when routed
JohnMovements
February 2013
If i acess a page through a route from my routes.php the POST data gets lost.
If i direct acess the controller the POST data is available.
What am i doing wrong i want to use routes.php?
Tia
John
Harro
February 2013
Accepted Answer
Huh?
If that wouldn't work, my guess is that 99% of all Fuel apps don't work. So something else must be going on..
Which version are you on? How do you route? And how do you access your post data?
JohnMovements
February 2013
Hi Harro,
Thats also my idea, i must be doing something very stupid.
This is my routes.php line:
'(\w{2})/socialMedia/facebookLink' => 'socialMedia/facebookLike',
And my function in the socialMedia controller:
public function post_facebookLike()
{
$inputData = \Input::param();
print_r($inputData);exit;
}
It's filled when i comment out the route otherwise it returns the route
(Array ( [/nl/socialMedia/facebookLink] => ))
My version is 1.5
JohnMovements
February 2013
Hi Harro,
Problem solved.
The headers where wrong so no $_POST data was received at all.
I tried firstline in index.php and even there $_POST was empty.
After changing the curl class in fuel (we use curl to access REST layer) everything worked.
protected function method_post()
{
$params = is_array($this->params) ? $this->encode($this->params) : $this->params;
$this->set_option(CURLOPT_POST, true);
$this->set_option(CURLOPT_POSTFIELDS, $params);
$this->set_header('application/x-www-form-urlencoded'); <--- ADDED LINE
}
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
February 2013
JohnMovements
February 2013