Search code examples
phpwebpage-screenshot

Is there any possible cacth a web screenshot in virtual server hosting with PHP?


I want catch web screenshots with PHP. Because I also need some process with PHP, I do not want use any on-line screenshot service. I am willing to renting a free hosting or a virtual server hosting which cost less than 20 dollars per year.

As I know, virtual server can not upload exe files (like url2bmp.exe, webshot.exe, webscreencapture.exe, etc). And they all use linux system (it can not use new COM("InternetExplorer.Application")).

So, is there any possible cacth a web screenshot in virtual server with PHP? Thanks.


Solution

  • You can do this with Linux, it is seriously tricky though. You need FireFox, imagmagik and VNC installed.

    Basically you get Firefox to open a new window in a VNC display, grab the screenshot of that display with imagmagik and then save it as a thumbnail. The hard part about this is getting the VNC portion to work, especially with a headless setup. But it is completely do-able.

    However, it will probably be a ton easier just getting a Windows VPS.

    Doing a search, found this which might work:

    Taking website screenshot, server-side, on a Linux rented server, free

    Ah and here is the post about what I described above:

    Command line program to create website screenshots (on Linux)