Jump to content

Using File Open


rascle

Recommended Posts

Hi

I have been looking at the tutorials on W3 Schools about file open but I havent been able to find what I want. I am trying to make some code that connects to a website (I can do that part) and search through the page until It reaches a specified piece of text, it would then change that code and save the file.

Does anyone know how I could do this??

Thanks

Rhys

Link to comment
https://forums.phpfreaks.com/topic/208850-using-file-open/
Share on other sites

Hi

I have been looking at the tutorials on W3 Schools about file open but I havent been able to find what I want. I am trying to make some code that connects to a website (I can do that part) and search through the page until It reaches a specified piece of text, it would then change that code and save the file.

Does anyone know how I could do this??

Thanks

Rhys

 

file_put_contents('/path/to/file/to/save.html',
			  str_replace('text to replace', 'replacement text',
						  file_get_contents('http://example.com/page.html'));

Link to comment
https://forums.phpfreaks.com/topic/208850-using-file-open/#findComment-1090954
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.