G
G
Glory2021-10-17 21:05:55
Laravel
Glory, 2021-10-17 21:05:55

Is it possible to somehow emit the execution of the php file recorded in the url through routes?

This is the request sent
by lara-1c.local/bitrix/admin/1c_exchange.php from 1c and it doesn't matter where else.

How would I make it with routes so that this url is treated as a route and if this request comes in to run the controller function? I can't implement it anyway.

If I simply create the 1c_exchange.php file in the public folder, then this file can even be launched. but I don't need it.
I need to catch all the parameters that are passed along with the file in the controller function.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Konstantin B., 2021-10-17
@Kostik_1993

Laravel doesn't care what you write in its routes. Such a route will be processed in the same way as all the others.

Route::get('/bitrix/admin/1c_exchange.php', function () {
    dd(request()->all());
});

You need to change the Nginx config, most likely you have the following location in it
location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass app:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }

He gives you 404
This is what Google gives for this

M
Mokhirjon Naimov, 2021-10-17
@zvermafia

Route::get('/bitrix/admin/1c_exchange.php', [SomeController::class, 'someMethod'])

?

V
Vyacheslav Plisko, 2021-10-20
@AmdY

You need to use a mask so that the framework does not break the route by slashes. Well, do not forget about security, so that absolutely any file cannot be opened.

Route::get('{path}', function ($path) {
    require $path; 
})->where('path, '.*'); // маска

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question