Jump to content

Editing a .cfg file


the_oliver

Recommended Posts

Hello. Is there a way i can use a php script to edit lines in a .cfg file?
I would like it to do something like: show what the file says, then optionaly change line [i]a number[/i] from
[i]nost type    ping_check[/i]

to

[i]host do      http_check[/i] (or whatever the user selects)


Also could this be done if the .cfg file is on a diffrent server?

Thanks
Link to comment
https://forums.phpfreaks.com/topic/28010-editing-a-cfg-file/
Share on other sites

See the parse_ini_file function.

http://www.php.net/parse_ini_file

As far as it being on another server, yes, in a very round about way.  If it's another web server, you could use the ftp functions to get and put the file.  If it's a server on an intranet, you could configure it to pull from that server's shared directories, assuming the permissions were set correctly.  Or, you could use WebDAV if the server has it.
Link to comment
https://forums.phpfreaks.com/topic/28010-editing-a-cfg-file/#findComment-128258
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.