开发者

Php multi stream library

Is there any php library (class) to deal wit开发者_开发百科h multiple http requests with stream_select? Or may be with non-blocking sockets.


I assume an HTTPRequestPool does what you are after?


This might be overkill, but check out NanoServ - a "server daemon framework for PHP 5.1+"

Here's a very minimal sample: "Dumb HTTP Server", from the examples page:

<?php

require "nanoserv/handlers/HTTP/Server.php"; 

class dumb_httpd extends \Nanoserv\HTTP\Server {    
    public function on_Request($url) {    
        return "You asked for url : <b>{$url}</b>\n";
    }

}

Nanoserv::New_Listener("tcp://0.0.0.0:800", "dumb_httpd")->Activate();
Nanoserv::Run();

?>


Checkout the code in http://drupal.org/project/httprl. I plan on pushing this lib to github once I get it more polished; something that can be ran outside of drupal. It should do what your looking for.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜