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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.