A web application for rating and reviewing university courses and professors, built with PHP and SQLite.
This repository includes a system for scraping course and professor data from university websites and importing it into the Rate My Teacher database.
- Web scraper for university course catalogs
- Import system that prevents duplicates
- Search functionality for professors and courses
- Display of real course and professor data on the homepage
- Detailed professor and course pages with reviews
- Clone this repository to your web server
- Ensure PHP is installed with SQLite and cURL extensions
- Set up the SQLite database using the SQL files in the
SQL Database Setupdirectory - Configure your database connection in
config.php
The course_scraper.php script will scrape course and professor data from the university website and save it to a JSON file.
php course_scraper.phpBy default, this will:
- Fetch course data from the university URL specified in the script
- Extract professor and course information
- Store the data in
database/scraped_courses.json - Ensure uniqueness by checking if courses/professors already exist
To adapt the scraper for your specific university website:
- Open
course_scraper.phpin a text editor - Modify the
$baseUrlvariable to your university's course catalog URL - Customize the
scrapeCourses()function to match your university's website structure - Adjust the parsing logic in
simulateCourseScraping()to extract the correct data
After running the scraper, use the course_import.php script to import the data into the database:
php course_import.phpThis will:
- Read the JSON data from
database/scraped_courses.json - Insert new professors and courses into the database
- Update existing records as needed
- Ensure proper relationships between courses and professors
To display the imported data on the homepage, run the update_homepage_lists.php script:
php update_homepage_lists.phpThis will:
- Fetch the top-rated professors and courses from the database
- Generate HTML for these items
- Update the
home.phpfile to display this real data
The search functionality in search.php allows users to search for professors and courses by name, department, or course code. The search results are displayed in real-time using AJAX.
search.php- Search API for professors and coursesprofessor_details.php- API for detailed professor informationcourse_details.php- API for detailed course information
- If you encounter permission issues, ensure the web server has write access to the database directory
- For large university catalogs, you may need to increase PHP's memory limit and execution time
- To change the appearance of search results, modify the CSS styles in
home.php - To adjust how ratings are displayed, edit the
generateStarRating()function inhome.php
- Created by Your Name
- Inspired by Rate My Professor