Preview webpage in php
#1
Posted 20 November 2006 - 06:19 AM
Example, A website where users can add their website URL. When it's added, you can see a small preview of the website...
#2
Posted 20 November 2006 - 01:48 PM
#3
Posted 20 November 2006 - 05:22 PM
Though, of course it would need some way of parsing the page in the first-place... I can't think of any web-based language that could do such a thing. You would have to use VB or C++ or whatever browsers are coded from, and find some way of having it generate an image, save it to the server/database, then have PHP able to grab the image.
I never even thought of how complex such a thing would be until now... I somehow assumed it was much simplier. :wacko:
#4
Posted 21 November 2006 - 02:27 PM
#5
Posted 21 November 2006 - 05:10 PM
it was worth a try
#6
Posted 23 November 2006 - 08:20 AM
This is how it is done. Atleast with my knowledge of trying and research.
The ImageMagick library has a screenshot function which will take a screenshot of the server's current screen. What you do is you is install X-Server which is a linux gui and then and then install Gnome or KDE to install the firefox browser. Thats as far as I got, I had to stop because my box's display card wasn't supported by my OS. So there is a lot of things to put into consideration. =/
#7
Posted 23 November 2006 - 08:29 AM
Chaos King, on Nov 23 2006, 02:20 PM, said:
This is how it is done. Atleast with my knowledge of trying and research.
The ImageMagick library has a screenshot function which will take a screenshot of the server's current screen. What you do is you is install X-Server which is a linux gui and then and then install Gnome or KDE to install the firefox browser. Thats as far as I got, I had to stop because my box's display card wasn't supported by my OS. So there is a lot of things to put into consideration. =/
Cool that would work nicely, just that i'm on a shared host
I'm sure Java can parse HTML and maybe even basic CSS but adding the images to the screenshot is going to be the problem I think.
I'll keep looking
#8
Posted 23 November 2006 - 07:51 PM
#9
Posted 25 November 2006 - 05:04 AM
#10
Posted 26 November 2006 - 11:16 AM
I don't think its compatible with CSS eathier.
It's php but it doesn't take a screen shot, it simply grabs the source code and returns it.
If you want, ill post it.
Edited by PhpFreak, 26 November 2006 - 11:17 AM.
#11
Posted 26 November 2006 - 12:05 PM
PhpFreak, on Nov 26 2006, 05:16 PM, said:
I don't think its compatible with CSS eathier.
It's php but it doesn't take a screen shot, it simply grabs the source code and returns it.
If you want, ill post it.
Does it parse the code aswell (give it in visual form) or is it just the plain source code?
Post t anyway, it's all good
Thanks mate
#12
Posted 26 November 2006 - 01:19 PM
when entering the url=http://www.yourdomain.com
You must include http://www. in it or else it will just return a blank webpage for most websites.
<?
function geturl($url){
$source = file_get_contents($url);
return $source;
}
if($_GET['url']){
echo geturl($_GET['url']);
}
else{
echo "Please enter a url, example:<br/>
http://www.thisdomain.com/thisfile.php?url=http://www.msn.com<br/>
Please note: This will only work if you have included http://www. in
the url.";
}
?>
Edited by PhpFreak, 26 November 2006 - 01:20 PM.
#13
Posted 26 November 2006 - 01:29 PM
I still don't have any ideas other than somehow having a server-side script access the page via a browser, then call the screenshot function somehow. So in terms, it would be more like a bot actually.
#14
Posted 26 November 2006 - 02:05 PM
I also explained what it does and gave him a choice to see the code or not, which he accepted.
If it is no use to him then he can scrap it, Theres no harm on giving it a try.
#15
Posted 26 November 2006 - 02:48 PM
anyway, can't curl do something like this?
#16
Posted 26 November 2006 - 03:19 PM
Anyone care to correct me?
#17
Posted 26 November 2006 - 03:26 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
