Hi. I would like to have an idea about the operation of creating a backup of a course and its restoration, to create a php that automates this according to the course code.
Got your PM ... 3 day turn around on this!!! Think you need to share here what you shared via PM to me as that was more descriptive than this posting.
From what you described in the PM, think I'd look into installing moosh which is a command line only utility for Moodle. It has several commands.
The second link will show various commands that might be able to put into a bash shell script to do what you want.
'spirit of sharing', Ken