View Full Version : URL Snapshot
02-15-2006, 09:23 AM
Anyone know`how to create a snapshot of a url using the image functions?
you mean like using cURL or so to request an url and then create an image that shows how the url would be rendered by a browser?
i don't think this is possible with only PHP. You'll need an extra soft to render the html (browser) and probably some extra soft (like SnagIT or so) to take the snapshot.
02-15-2006, 11:08 PM
@raf: I'm not sure if it really is impossible...
If you think about it.. php should be able to contact a target website over port 80 and receive the same source that a visitor would .. and PHP has the GD Libary to create images. And you could probably try and take the rendering engine of a browser to parse the html...
It would be complicated and not easy, that is sure, but I doubt that it is impossible. Especially if you have direct server access, as you can execute files over php..
That is all theory though so don't ask me for details. :)
you're not realy giving any real hint to a sollution...
like i said, you need so soft to, render the code (which you comfirm) and then you'll need some soft to take the snapshot (which you wanna do using the GD Library --> how exactly would that be done?).
02-17-2006, 02:53 AM
@Raf I am referring to the second of your comments
to request an url and then create an image that shows how the url would be rendered by a browser?
Don't rack your brains about it. It was more of a "I wonder how" type of thing. Anyone know what they do on Alexa.com? Like if you were to type in a website name it shows you a thumbnail of that site. I did this the other day on a site I used to work for and it had a snapshot of alteast 2 years ago up. Just wondering on the technology used. I didn't/don't think they manually do this.....would they? How much am I over thinking this?
02-17-2006, 11:46 AM
You could just take it off Alexa.com....
Would give a thumbnail of google's homepage
One way you can do it is you have a browser such as mozilla installed on the server, and you also have X running (and a window manager), you can get a screenshot this way:
Leave the browser window open, fully maximized, in your server's X session. Run the command (from your script):
mozilla -remote openURL('http://www.mysite.com')
This should open the URL up in the servers X session. Once that is done, take a screen shot with any of the available tools for X. We'll use xwd as an example:
xwd -frame -root -out myscreenshot.xwd
This will take a full screenshot of the X root window, which should have the browser window open at that URL.
After that, you may have to use ImageMagick or NetPBM to convert the file into something usable for the web.
Hope this helps, even if it just points you in the right direction.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.