Hi,
I've been working with third party API integration where I receive a callback on a specified url, with get parameters sent as query string. This was working perfectly and I was able to handle the received parameters and manipulate with them as needed. However, it suddenly stopped working and all I can handle as get parameter now are the URI segments. I read that this happened after a Laravel update and I really need a way to re-enable the query strings. Is that possible?
Here is an example of what I need:
This is the url: http://cb.com/main/my-function?name=test&action=open
This is how I handle it:
$input=Input::get();
dd($input);
I expect to get this as a result:
array(2) { ["name"]=> string(4) "test", ["active"]=> string(4) "open" }
I get this instead:
array(1) { ["/main/my-function/"]=> string(0) "" }
Is there any way to get the query parameters in the route? I think I read every possible thread regarding this, but there's nothing helpful so far. Any help is appreciated!
You should use:
Input::all();
Use GET only when you want to retrieve only one parameter like:
Input::get('name');
I've tried that as well, nothing's working. I created this function a while ago and it was successfully receiving the callbacks. I was just testing some functionality and realized it stopped working. Which ever way I try to use for reading the get parameters, I only end up with the uri segments.
I tried replacing the '?' with '/' (the url will look like this in that case http://cb.com/main/my-function/name=test&action=open) and I get array(2) { ["/main/my-function/name"]=> string(4) "test " ["action"]=> string(4) "open". There must be a way to enable the question mark in the url..
In case anyone else has the same problem, try checking your .htaccess file. This is the default http://laravel.io/bin/eDWNo. My .htaccess file was changed and that's why all query strings stopped working. After getting it back to the default. everything worked perfectly.
I've been googling this for hours and couldn't find anything related. One tip: use the IRC channel(http://laravel.io/chat), you will definitely find your answer there.
Cheers!
I just signed up here to let you know that you saved my life :) I've been having this problem since 3 hours and had no clue how it all started or how to fix it. As it turns out, the .htaccess was the problem. Thanks for reporting back your solution. A good deed goes a long way. Your reply from 2 years ago, just saved me probably many hours of frustration. Thanks ;)
TheCady28 said:
In case anyone else has the same problem, try checking your .htaccess file. This is the default http://laravel.io/bin/eDWNo. My .htaccess file was changed and that's why all query strings stopped working. After getting it back to the default. everything worked perfectly.
I've been googling this for hours and couldn't find anything related. One tip: use the IRC channel(http://laravel.io/chat), you will definitely find your answer there.
Cheers!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community