You know web scraping is a useful technique of data extraction from websites, especially if there is no any API or there is a ton of data that can’t be got in another way. The most simple and well-known way is to use CURL. But it is easy only in the aspect of using third-party components and widespread because of its universality. Our goal is…
Category: PHP Recipes
Installing and configuring virtual ubuntu server using Vagrant
What is Vagrant? Vagrant is free and open-source software. It is used for creating and using virtual development environments. Vagrant is a wrapper between VirtualBox (or other virtualization software) and configuration management. Why do we need it? Usually, each developer in team has own development environment, which configured for his needs. But this may become troublesome. The same web application may work as expected in one environment,…
Automating SQL injection analysis with PHP, sqlmap, Gearman
If you’re in web development area, you certainly know about SQL injection attack. There is also a well-known joke about it on xkcd: There is a tool for automating SQL injection discovery, called sqlmap, you can find it on github
PHP Website Scraping using Chrome Web Driver
Sometimes it happens that there is a complex website that is can’t be parsed with so called “regular” cURL + DOM xpath technique. People tend to protect their data with Javascript techniques, nowadays there are pure-Javascript sites popular, and, as you know, one can’t interpret JS using PHP or any other language you’re using for scraping (unless you scrape with nodejs, but I haven’t tried…
Backup of MySQL database with a PHP script
Sometimes you need to make a mysqldump backup without having SSH access or PHPMyAdmin. It can be done with PHP by means of SHOW TABLES/SHOW CREATE TABLE mysql queries. Below is an improved solution proposed here. Improvements: [list style=”upper-alpha tick”] [list_item]Got rid of memory_limit – writing to file on every iteration[/list_item] [list_item]gzip support – you don’t have to download huge uncompressed .sql[/list_item] [list_item]PHP notice fixed[/list_item]…