Find the answer to your Linux question:
Results 1 to 4 of 4
Hi all, I need your suggestions and help very much! I have a server application (written in C) specified to get networking information (clients' IP addresses, clients location, transmission rates, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2005
    Location
    Europe
    Posts
    4

    How to use PHP to display a "dynamic" file?


    Hi all,

    I need your suggestions and help very much!

    I have a server application (written in C) specified to get networking information (clients' IP addresses, clients location, transmission rates, etc ) and save the data into a file. The file can be always changed due to the network is not static like changing the client's IP address or moving the client. However, the file can be in charge of those changes and it always has the newest information. Now I want to develop a web page to display the newest information in real time or almost in real time, but I have no idea how to start.

    Firstly, should I invite a database here? The parameters (IP address, identity number, location, etc) has their correlations between each other. But I do not want to add a database if not necessary. If a database is a benefit, how to let a database to acquire the data from the file on time and how to keep the web-page refreshing its display.

    Then, which language is the best choice? I perfer PHP as the constrains of that the system does not support Java quite much and well. By the way, I am very new to writing PHP as well as developing a dynamic website with database, so it would be very appreciate if you can explain as detailed as possible. The tutorials, useful code resource, similar projects, relevant topics, forums are always welcom. Thanks!

  2. #2
    Linux Newbie deek's Avatar
    Join Date
    Mar 2005
    Location
    Fort Wayne, IN
    Posts
    248
    Instead of using a database, you could easily (by changing some of your c code), format the output file in xml, then you could pickup that file (now in an xml format) through php and just make a simple page...

    The page would be static per se, as it is always going to the same data source, but would appear to be dynamic as the output is changing based on your running the c code.

    By adding a database piece, you would need to do two things: 1) feed your c code output into the database and 2) through php, connect to the database and pull the data you want.

    That second point, you will have to do either way, either from the xml file (which may be easier if you are not familiar with SQL commands) or from the database...

    There are tons of php tutorial sites, just do a google on it. The php for either option is fairly basic and straightforward, really.
    Join the Open Source Revolution. Support GNU/Linux.

    Find me at: www.deeksworld.com
    Registered GNU/Linux User #395777

  3. #3
    Just Joined!
    Join Date
    Oct 2005
    Location
    Europe
    Posts
    4
    Thanks very much!

    And can the database communicate with C application directly? do I need to write or use a middleware application between them? Thanks if you can hint me on this problem.

  4. #4
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    And can the database communicate with C application directly?
    No, but the C application can probably communicate directly with the database, or at least indirectly using the database's interface library. Which database are you using - MySQL?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •