Evaluating php tags/documents outside of web server?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Isak

    Evaluating php tags/documents outside of web server?

    I need to generate and send multiple xml documents over a socket.

    Is it feasible to use php as a templating language for these? How would
    i go about that?

    I figure i _could_ make them into 'normal pages' and fetch the contents
    using some http library, but that doesn't sound too elegant. There has
    to be a better way?


    Thanks,
    Isak

  • petersprc

    #2
    Re: Evaluating php tags/documents outside of web server?

    Hi,

    Yes you could use PHP, for example:

    foreach ($items as $item) {
    ob_start();
    require('xml-template.php');
    $text = ob_get_contents ();
    ob_end_clean();
    fwrite($sock, $text) or trigger_error(' fwrite');
    }

    You could also build the XML tree programmaticall y. Some examples here:



    Isak wrote:
    I need to generate and send multiple xml documents over a socket.
    >
    Is it feasible to use php as a templating language for these? How would
    i go about that?
    >
    I figure i _could_ make them into 'normal pages' and fetch the contents
    using some http library, but that doesn't sound too elegant. There has
    to be a better way?
    >
    >
    Thanks,
    Isak

    Comment

    Working...