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,…
Category: PHP As Is
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]…
Don’t use adding 86400 seconds in real life
Consider the following example: $date = strtotime(’23 Oct 2009 00:00:00’); $end = strtotime(’26 Oct 2009 00:00:00’); while($date < $end ) { echo date(’Y-m-d’,$date).PHP_EOL; $date += 86400; }