使用php另存为网页
问题描述:
如何使用php保存网页,类似于在浏览器中另存为->文件->将网页另存为 当url作为参数时,我需要动态保存网页.将图像包含在相关文件夹中.
How to save a web page using php similar to save as in Browser -> file -> save page as I need to save web page dynamically when url is given as parameter. Containing the images in related folder.
先谢谢您了:)
答
您将需要使用php curl从该页面下载HTML.
You would need to use php curl to download the HTML from that page.
此后,您需要使用readfile()函数抓取图像,css,js和其他文件的内容,并下载并保存它们以节省路径.
After that you need to scrape the content of images, css, js and other files and download and save them conserving the path, by using readfile() function.