Taking website screenshots using PhantomJS

In one of my previous posts we saw how we could take webshots of web pages using ‘wkhtmltoimage‘ toolkit. Now we have something more flexible with PhantomJS. PhantomJS is what we call a headless WebKit with JavaScript. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG. You can programmatically access web page content for scraping, monitoring or testing purposes, including webpage features that work with JavaScript, which is not possible using server side languages. For most reasons you can think of it as a browser without a window, where we drive it via JavaScript. Here we are using it to grab the webshots of web pages.
(more…)

Read More

Downloading Gmail attachments using PHP

Automatically extracting attachments from Gmail can be important for reasons where you need to process the attached files periodically with a CRON job. Also it can be useful for automatically archiving important attachments. Below is a simple proof-of-concept plain PHP code, devoid of any object-oriented features that extracts attachments from your Gmail account. It uses PHPs imap extension to access the inbox.
(more…)

Read More

Auto Saving your web form data

There is nothing more frustrating than filling a complex web form and just as you are ready to submit it, you accidentally hit refresh, close your window tab or the browser just crashes on you. Only if you could add some kind of auto-save feature to the form to mitigate this problem. Applications like Gmail, WordPress both support the auto-save feature, albeit in a technically different way.
(more…)

Read More

PHP 5.4.0 in a nutshell

Although purists have always sneered upon PHP for being a “patched” language; the evolution of PHP over the years, with new features added in every version, has only increased its popularity. The latest 5.4 release has followed the trend with some major feature additions. The following post describes some important changes in PHP 5.4.
(more…)

Read More