Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving a webpage using script

Status
Not open for further replies.

kosmokramer

Programmer
Sep 8, 2002
73
US
Hey. I am looking for a way to save the source of a webpage using php. What I need is for the source to be saved as a text file so I can do a search on it. Thanks for any help!
Paul
 
As for saving:
$handle = fopen($filename, 'a');
fwrite($handle, $somecontent);
fclose($handle);

You can retrieve the HTML using
$somecontent = file('as long as the php.ini is configured to allow for that:

If you PHP was compiled with cURL you can use the CURL functions to get the HTML. This is more advanced an more complicated.

For writing the file you need different privileges according to OS. Since I don't know what OS, I'll not comment on it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top