开发者

Php multi stream library

开发者 https://www.devze.com 2023-03-11 20:04 出处:网络
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 mig

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

精彩评论

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