I would like to take the screenshot of the website page using a php script. What I’m expecting is a command where I can provide the URL, and it will create a screenshot in png or jpg format.
I think it means you need a server with a windowing environment (so not just command line). You need a server somewhere that actually runs the site in a web browser so that an image can be saved and you can then grab the image.
I did this exact same thing about 4 years ago, and that’s pretty much the process we had to go through.