среда, 11 сентября 2013 г.

xinetd for http

service ws
{
   port            = 8022
   socket_type     = stream
   wait            = no
   type = UNLISTED
   user            = root
   server          = /usr/bin/php5
   server_args = /root/ws.php
   log_on_success  += USERID
   log_on_failure  += USERID
   disable         = no
   #bind = 127.0.0.1
#       flags=REUSE
}



<?php
ob_start();


echo "Node is running.";


$r=ob_get_contents();
ob_end_clean();
resp($r);

function resp($d){
 $l=strlen($d);
 echo "HTTP/1.1 200 OK\r\n";
 echo "Content-Type: Content-Type: text/plain\r\n";
 echo "Connnection: close\r\n";
 echo "Content-length: {$l}\r\n";
 echo "\r\n";
 die($d);
}




Комментариев нет:

Отправить комментарий