Consult the expert: data import and export between two php platforms PHP moodle data transmission
Requirements:
The student information (user name, password, name, email, and professional code) on the enrollment platform is imported to the corresponding data table in the moodle platform database,
Enables students to log on to the moodle system using their usernames and passwords on the moodle platform for online learning and course quizzes,
After the test is completed, the score (user name, professional code, course name, course score) of the students is exported to the enrollment platform. the students can view their score information.
Requirements:
These operations are automatically updated at every day to automatically import and export student information and student scores.
Now I need to write a script file and execute it regularly. please advise me what is the main step of this function? what kind of transition storage, array or file should be used for data transmission between different databases on different platforms? Or session or cookie?
Online ......
Reply to discussion (solution)
I have never done it. I 'd like to give you some ideas.
Data Transmission Interface. platform B regularly executes the php file every day and requests the corresponding interface of Platform A. Platform A sends new data to Platform B through the interface. platform B receives the data and enters the database.
You can use shell scripts.
Can the two platforms directly access the database? if possible, you can directly use shell scripts to insert database B from database.
If not, you need to develop response interfaces.
Insert the database to actively pull data:
The registration platform must provide interfaces for obtaining user information in batches.
The moodle platform provides an interface for batch score information
Insert database passive update data:
The registration platform must provide an interface for inserting score information in batches.
The moodle platform provides an interface for batch inserting user information
Both parties can use post json for communication or directly download txt files.
However, the above are closely related inserts, not updates. for example
User a is already on the moodle platform, but User a's password has been changed on the enrollment platform. how does user a synchronize this password?
You cannot update all users at a time.
Therefore, the best way is to provide sso on the enrollment platform, so it is King to keep the registration platform and the moodle platform synchronized login and logout.
First, determine the database. if possible, use a third-party tool.