简体   繁体   中英

How to save all resources downloaded from a HTTP request in PHP

Is it possible to save all resources downloaded from a HTTP request with PHP?

For example: using curl, wget or similar to get all files necessary to load the page in browser instead of only getting the HTML content of the page.

I don't want to get all links and then download each link with a direct curl. I would like a way to do it only once. I assume it's possible since in a browser I also only do one url request to get all resources.

Edit: The point here is to simulate the browser behavior. How can I save an entire page with PHP. If it must be done with several steps what should be the logic to follow? I have huge problems in getting all files from a page even after extracting links since I find it very hard to store session data and reuse it for further curls.

You can use Ajax for that and save that as objects and show them when needed. does that works for you?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM