is it possible to send POST request from external server to Moodle and then, already in Moodle, doing some actions with data and save to DB(DB table created by local plugin). Have any possibilities to do that? Thanks all for help.
You can use web services
https://docs.moodle.org/dev/Web_services
Here are some brief instructions
/admin/search.php?query=enablewebservices
/admin/settings.php?section=webserviceprotocols
/admin/settings.php?section=externalservices
/admin/roles/manage.php
webservice/rest:use
/admin/settings.php?section=webservicetokens
Then in php
you can do something like this:
$tokenurl = 'http://[url]/login/token.php?username=xxx&password=xxx&service=yourserviceshortname';
$tokenresponse = file_get_contents($tokenurl->out(false));
$tokenobject = json_decode($tokenresponse);
if (!empty($tokenobject->error)) {
echo $tokenobject->error;
die();
}
$functionurl = 'http://[url]/webservice/rest/server.php';
$functionurl .= '?wstoken=' . $tokenobject->token;
$functionurl .= '&wsfunction=functionname';
$functionurl .= '&moodlewsrestformat=json';
$functionurl .= '¶m1=xxx';
$functionurl .= '¶m2=yyy';
$functionresponse = file_get_contents($functionurl);
$object = json_decode($functionresponse);
var_dump($object);
For a complete list of available functions see /admin/webservice/documentation.php