First of all, i am not sure, if it is possible to capture browser window screen with php, then how to do it?
If it is possible, the best will be to capture just the website content excluding browser parts such as menubar, toolbar, statusbar, etc.
Thanks
There is imagegrabscreen()
and imagegrabwindow()
, which would allow you to programmatically create screenshots from a browser running on the same machine via COM (Win only though). See the comments in the manual for how to omit the browser's chrome. With DCOM enabled, this would also work with remote windows machines that have been setup to allow access through DCOM.
On a sidenote for those that said PHP does not know about the browser, I'd suggest a look at get_browser()
in the PHP manual. It's not much, but hey, it's not nothing.
This can absolutely be done, it just takes a little more than PHP to make it happen. I have an application written in PHP that takes snapshots of websites at certain intervals. It's a bit tricky to get going but here's the steps I took on a Linux machine:
.
#!/bin/bash
DISPLAY=:1 firefox &
sleep 2s
DISPLAY=:1 firefox -kill-all &
sleep 1s
DISPLAY=:1 firefox -url $1 &
sleep 5s
DISPLAY=:1 import -window root /var/www/images/screenshots/$2.png
.
exec ('sh ../scripts/screencap.sh ' . $url . ' ' . $file_name);
The trickiest part for me was to get the browser to be full screen when the screenshot occurred. Because you can't access the browser directly, you have to configure everything via Firefox's config files, which can take some time to figure out.
Useful links to help you get started:
http://semicomplete.com/blog/geekery/xvfb-firefox.html http://www.webmasterworld.com/forum21/9182.htm
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With