$_GET['url']; is not working
if i try the below code, I am able to get the string 'testinggoogleurl' on the page successfully when I go to
http://mydomain.com/testing
Route::get('/testing', function () {
echo "testing string";
});
However, if I use the below code and go to http://mydomain.com/testing?url=sometext
i get an error page http error 500
Route::get('/testing', function () {
$url = $_GET['url'];
echo $url;
});
The above code works fine in my local laravel installaton. Does not work on Digital Ocean laravel installation. pls advise
Maybe there is something wrong with your htaccess config. You should look into server logs, they might tell you something more.
You could check, what's exactly inside the $_GET via
Route::get('/testing', function () {
dd($_GET);
});
Also it's generally a good idea to use request helpers like
request()->get('url');
// or just inject the request into the method, and then use $request->get...
or
Input::get('url');
Please or to participate in this conversation.