Hi all,
I currently have an html form that is used to register devices on my network. When someone goes to this form and puts in the MAC address, once they hit submit, two files must be created in the directory. A 'mac.cfg' and a 'mac-registration.cfg' (where mac=the mac address of the device). How would I implement this code so that I can open these files under these names and insert the information into it?
Thanks in advance,
Matt
Need to open files under specific names through PHP
Moderator: General Moderators
Re: Need to open files under specific names through PHP
Code: Select all
$fp = fopen('mac.cfg','w');
fwrite($fp, $the_info);
fclose($fp);This sounds like VoIP phone configurator, something i worked on before. Are you working for TierZero ?
Re: Need to open files under specific names through PHP
Yes, this is for Polycom VOIP phone registration. Each phone needs two files to operate. Say I have a phone with MAC address of 0004f2151809, I need to create two files: (1)'0004f2151809.cfg' (2)'0004f2151809-registration.cfg'
How would I create a code to open these files for each individual polycom phone?
Thanks,
Matt
How would I create a code to open these files for each individual polycom phone?
Thanks,
Matt
Re: Need to open files under specific names through PHP
First you should know all the mac addresses you have in the network and insert them in a HTML form, then submit it, process the entries in a loop and with fopen / fwrite / fclose generate file for each device.
You can set a variable and place the the configuration template inside. Take a look in the php manual for the function sprintf() to understand how to change the config values for every device.