This is extremely difficult. I know because I have done it.
Basically you need to:
- Invoke a web browser or web browser component somehow on an invisible screen on your server
- Instruct it which web page to navigate to
- Wait for it to finish rendering the page
- Ensure that it does not open any unwanted popups, dialogues etc (e.g. SSL warnings, HTTP authentication, which might be built into the browser)
- Somehow snapshot the screen
- Get that into PHP somehow
Some of these steps are extremely difficult and would involve significant hackery on to existing browsers (especially waiting for it to finish loading).
It also tends to use up a lot of server resources.
There are existing web services which will do this work for you; I strongly recommend you find and use one of those (unless you enjoy the intellectual challenge of doing it yourself; I did).
Mark