473,466 Members | 1,363 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to create a snapshot of a URL in PHP?


Hi

Given a URL I want the snapshot of that page as an image. Something
like
http://pthumbnails.alexa.com/image_s...p://google.com

How do I achieve this in PHP?

-- Mahesh

Jul 31 '06 #1
4 3439
"BG Mahesh" <ma****@mahesh.comwrote:
Given a URL I want the snapshot of that page as an image. Something
like
http://pthumbnails.alexa.com/image_s...ze=large&url=h
ttp://google.com

How do I achieve this in PHP?
You can't, at least not with PHP on its own, unless you spend months
developing an HTML renderer.

How about scripting a web browser? You can install Mozilla on the
server, and your PHP program can ask it to render the page, print it to
PostScript, and then use ImageMagick to convert that to the image format
of your choice.

miguel
--
Photos from 40 countries on 5 continents: http://travel.u.nu
Latest photos: Malaysia; Thailand; Singapore; Spain; Morocco
Airports of the world: http://airport.u.nu
Jul 31 '06 #2
Miguel Cruz wrote:
"BG Mahesh" <ma****@mahesh.comwrote:
Given a URL I want the snapshot of that page as an image. Something
like
http://pthumbnails.alexa.com/image_s...ze=large&url=h
ttp://google.com

How do I achieve this in PHP?

You can't, at least not with PHP on its own, unless you spend months
developing an HTML renderer.

How about scripting a web browser? You can install Mozilla on the
server, and your PHP program can ask it to render the page, print it to
Hi Miguel. I'm not the OP, but would you please elaborate on how you
would get Mozilla to do this?

One possible approach is with a GreaseMonkey type of solution. But can
you use GM with javascript turned off? I have not investigated this.
I think one should have javascript turned off in deciding what,
exactly, to render, else you can run the javascript into a hole with an
alert.

One could also bring up Mozilla/FF directly with a page, but then I
don't know how to programatically direct it.

With IE ($ie=new COM("InternetExplorer.Application")) one can bring up
an instance of IE and load a page
($ie->Navigate2("http://www.myFavoriteDomain.com")), but I haven't
tried saving saving this (and it doesn't show me an option to save as
an image).

That is, in neither FF nor IE do I see the option to save the page as a
Postscript page or anything I would construe as an image. Where do I
look for this?

Csaba Gabor from Vienna

Jul 31 '06 #3
"Csaba Gabor" <da*****@gmail.comwrote:
Miguel Cruz wrote:
>How about scripting a web browser? You can install Mozilla on the
server, and your PHP program can ask it to render the page, print it

Hi Miguel. I'm not the OP, but would you please elaborate on how you
would get Mozilla to do this?
Sounds like you're using Windows. Unfortunately I'm probably not the
best person to help you, as I'm using a Mac. With AppleScript it's
pretty trivial to do this, then just invoke the AppleScript with PHP.

Some possible leads for the platform-impaired to check out:

http://dev.hyperstruct.net/trac/mozlab/wiki/MozRepl

http://www.mozilla.org/unix/remote.html

miguel
--
Photos from 40 countries on 5 continents: http://travel.u.nu
Latest photos: Malaysia; Thailand; Singapore; Spain; Morocco
Airports of the world: http://airport.u.nu
Jul 31 '06 #4
On Tue, 01 Aug 2006 05:22:37 +0800, Miguel Cruz wrote:
Sounds like you're using Windows. Unfortunately I'm probably not the
best person to help you, as I'm using a Mac. With AppleScript it's
pretty trivial to do this, then just invoke the AppleScript with PHP.
Another option may be to use the Firefox extension Page Saver
<http://pearlcrescent.com/products/pagesaver/>, which apparently has some
command-line options to generate a PNG from a URL. I've only used the
in-browser options, myself, but it seems to produce pretty good output.

Not affiliated with them, may blow up in your face, insert your favourite
disclaimer here. :)

Adam

--
Adam Harvey

To e-mail: don't make an example out of me!

Aug 3 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Bernhard Krautschneider | last post by:
hello group, is it possible to do a storage snapshot of a running ms-sql database without losing transactions? What tasks must be done before such a snapshot. thanks in advance, Bernhard
8
by: cainlevy | last post by:
I'm wondering if there's any way to speed up create table queries? Besides upgrading hardware, that is. The very simplest table creation query, "create table table1 ( field1 INT(10))" is taking...
8
by: Jean-Marc Blaise | last post by:
Dear all, It seems there is a problem with some snapshot table functions, if you try to divide by some element that is unset or equal to 0. This generates a trap file with the db2fmp.exe...
4
by: Civilian_Target | last post by:
Is there any way in DB2 to automate the taking of a snapshot, for example, a function that will cause a db2 snapshot to be taken every 5 minutes and written to a uniquely named file? Am I better...
14
by: Ina Schmitz | last post by:
Hello, I would like to get the logical and physical reads for every sql statement executed. Thatfore, I used the command "db2 get snapshot for dynamic sql on <mydatabase>". There, I could see...
5
by: tom | last post by:
Hey All- I've exported a report to Access's "snapshot" format and want to put it on a website for users to view. However, when I click on the link to the snapshot file, I notice that my browser...
9
by: bluedolphin | last post by:
Hello All: I have been brought onboard to help on a project that had some performance problems last year. I have taken some steps to address the issues in question, but a huge question mark...
4
by: Bob Quintal | last post by:
And if it can be done, what things should I check to fix the issue below. Some users just have Acc97 RUNTIME and not full Access. I rolled out a new app today to a user who only has hte runtime,...
1
by: shenanwei | last post by:
I have db2 v8.2.5 on AIX V5.3 with all the switches on Buffer pool (DFT_MON_BUFPOOL) = ON Lock (DFT_MON_LOCK) = ON Sort ...
4
by: MPD | last post by:
Hi How can I create a job in sql agent to create a new snapshot every hour? I have, for eg a T-SQL that does it manually. create database Snapshotter_snap_20070418_1821 on ( name =...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.