This is a PHP-based web scraper for bina.az that collects property listings from owner-posted ads and sends them to a Telegram channel.
- Scrapes property listings from bina.az
- Filters for owner-posted listings only
- Stores listings in a MySQL database
- Sends notifications to a Telegram channel
- Runs automatically every 30 minutes
- Comprehensive error logging
- PHP 7.4 or higher
- MySQL 5.7 or higher
- Composer
- PHP Extensions:
- PDO
- curl
- mbstring
- dom
- Clone the repository:
git clone [repository-url]
cd bina-scraper- Install dependencies:
composer install- Set up the database:
mysql -u root -p < database.sql- Configure environment variables:
cp .env.example .envEdit .env and add your database and Telegram credentials.
- Set up the cron job to run every 30 minutes:
*/30 * * * * cd /path/to/bina-scraper && php run.php >> /path/to/bina-scraper/logs/cron.log 2>&1To run the scraper manually:
php run.phpLogs are stored in the logs directory:
scraper.log: Contains detailed scraping information and errorscron.log: Contains cron job execution logs
The scraper includes comprehensive error handling:
- Network errors are logged and retried
- Database errors are logged with full stack traces
- Malformed HTML is gracefully handled
- Rate limiting is respected with sleep intervals
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request