How to save a web page as HTML using PHP

Status
Not open for further replies.

jitun

Broken In
The question is simple i want to save the content of any webpage to simple html so that it can be viewed locally. I can easily get the page content using get_file_content or using curl but the links(a href), scripts and css wont work as they are defined by their relative path in most of the pages. So i wanna to know how to fix those so that the page will work by itself if it is run locally from my system? I suppose they can be fixed using regular expression but i am not very good at regex.


Please Help.
 

victor_rambo

हॉर्न ओके प्लीज़
You will have to use regex to place the <baseurl> and then write the file to disk using fopen and fwrite.
 
Status
Not open for further replies.
Top Bottom