This question already has answers here:
Closed 12 years ago.
Possible Duplicates:
How can I generate a screenshot of a webpage using a server-side script?
Taking screenshot of a webpage programmatically
How can I make a script in PHP for take a screenshot of a URL?
When I take a URL as an input I would lile to get a screenshot for that URL.
A screenshot is taken from a browser. The only way to do this from server-side PHP code is to make a call to a browser that lives on the server, ask it to go to the URL, and ask it to take a screenshot, and place it somewhere or return it over socket.
Instead of a browser standalone EXE file, you could also use a library that you can call from PHP which has HTML rendering capabilities.
Take a look at these similar Stack Overflow questions, they might help:
Taking screenshot of a webpage programmatically
Programmatically get a screenshot of a page
How can I generate a screenshot of a webpage using a server-side script?
Related
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Website screenshots using PHP
how can i take a screen shot and save it in PHP? I wana take a screen shot a users screen and save it to user's machine when he/she clicks on save button. Is there any way to do this??
You can't do this in PHP.
You could do this using HTML5/Javascript, something like HTML2Canvas does.
Your problem with that would be compatibility with older browsers. So using this would depend on who the website is aimed at.
You have to understand one thing that PHP is a server side script and nothing to do with real time browser needs. You may try JavaScript with some library like jQuery to capture the screenshot. Then you may pass that image via AJAX and there, you can definitely use PHP to save the image into your server directory.
this stackoverflow question may help you.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Create a PDF file with PHP
I have created invoice generator using javascript. well I am able to work on it. Now what I have to do is I have to generate the data in the pdf which are available in the invoice. I tried some but none work out. So If there is anyone who can help me out?
Thanx in advance
I have used "webkit html to pdf" (wkhtmltopdf) several times.
It worked well for me, although working with page breaks is a bit of an hassle.
PDF cannot be generated at the client side (I mean with Javascript). You will need to process the invoice data at the server side using a PDF library and write to a URL location, so that it can be downloaded or opened in a browser.
TCPDF is a good tool to generate PDF with PHP. See this link.
Also see this question.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Website screenshots using PHP
I have an application where people watch a stream of content (a video stream) and need to click a button each time something happens (suppose they see a red light).
I want to somehow screenshot the stream at the moment where the user clicks the button.
The problem is that the stream is not mine and I am using an IFrame to another page with the stream. The stream is a flash object.
I need to screenshot the page at the moment of click with the flash content using PHP/Javascript and save it on the server.
I saw something that seems similar to what I need but the solution is using C# and .NET.
Programmatically get a screenshot of a page
EDIT:
Idea, if anyone can explain it best here, how could I do that using a plugin/java applet or something that the user might install when entering the site. (The easier the better).
You can't get a screenshot client-side, and certainly not with PHP. PHP runs on your server, not on the client.
The only way to do this would be to write a browser plugin of some sort, or utilize Java.
See this post: Take Screenshot of Browser via JavaScript (or something else)
After a request to view your website has been made by a browser, your PHP code is run and generates the content of the page. By the time your user sees the page, the PHP has finished running, and the content of the page is static as far as that is concerned (although of course can be changed by other means, like ajax or javascript).
That's why this isn't possible at all with PHP, and it's not possible by another means for security reasons (for example, it could reveal any client-side scripts the user is running, etc.).
The only way a screenshot could be taken would be to render it yourself. The only way I can think of offhand would be to get the time on loading of the page, then the time when the button is pressed, and render the page for this long, but this is by no means foolproof and not really a valid suggestion.
I'm afraid that you'll probably have to redesign this portion of your site.
Since you say that the stream is a Flash object, you could simply read it into a Flash enviroment. Flash would allow you to do what you want - saving screenshots, or, better said, images generated by that Flash, i.e. still frames. However, I am not sure if Flash would allow you to make a screenshot of the display incl the OS enviroment.
This question already has answers here:
Closed 11 years ago.
Possible Duplicates:
How to encrypt my HTML, PHP & JavaScript?
How to disable or encrypt “View Source” for my site
If we click to View Page Source option of browser then you can not only view the code but also copy and reuse as your need. But some time you don't like to forward your code without permission, so how can you hide your web page source code form users so that s/he could not copy your code without your permission.
I visited it a website
and if you view it's source code and paste on a web supported file (html, htm, php, etc) then you can not edit some of the text as well as you are not allowed to access some css.
You can't restrict to copy or anything.
One option you have is to Obfuscate your source. Obfuscation basically compresses and/or renames variables, methods. It makes things a bit faster and the code gets a lot more difficult to understand.
See
PHP code to obfuscate HTML?
Is there a code obfuscator for PHP?
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Website screenshots using PHP
I want to create a script that will show the thumbnail of a site (let's say 400*300px ). I don't want sites like www.bitpixels.com .
So the answear could come in 2 ways:
1) You explain how could I take the screenshot of a website (using only PHP,ajax, etc,... no .NET or other stuff like that :D )
2) You know a website that offers this type of service for free and there's no limitation in the number of thumbs you can get, or their size.
You may want to try wkhtmltopdf (webkit-based html to pdf conversion), it also contains wkhtmltoimage, a version of it that outputs images. It's open source and if you have any sort of dedicated machine you should be able to use it. Otherwise I am not sure. Since it is webkit based it should provide you with a decent rendering of the page too.
Another great tool for this is PhantomJS