public function run() { event_init(); $this->httpd = evhttp_start($this->addr, $this->port); evhttp_set_gencb($this->httpd, array($this, 'processRequest')); echo "XML-RPC server started at http://{$this->addr}:{$this->port}/xmlrpc...\n"; event_dispatch(); }
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL Kargo Global Inc. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Author: Florian Hoenig <*****@*****.**> */ function test_callback($evhttp_request) { echo "script-land memory: " . memory_get_usage() . " and real memory from system: " . memory_get_usage(true) . "\n"; $uri = evhttp_request_uri($evhttp_request); $ct = evhttp_request_find_header($evhttp_request, 'Content-Type'); echo "URI: {$uri}\n"; echo "Content-Type: {$ct}\n"; print_r(evhttp_request_headers($evhttp_request)); echo evhttp_request_body($evhttp_request); evhttp_response_add_header($evhttp_request, "Content-Type", "text/plain"); return evhttp_response_set("Hello World!", 200, "OK"); } if (!extension_loaded('event')) { dl('event.' . PHP_SHLIB_SUFFIX); } event_init(); $httpd = evhttp_start("0.0.0.0", 8080); evhttp_set_gencb($httpd, 'test_callback'); event_dispatch();
public function run() { event_init(); $this->httpd = evhttp_start($this->addr, $this->port); evhttp_set_gencb($this->httpd, array($this, 'processRequest')); echo "Application listening at {$this->addr}:{$this->port}...\n"; event_dispatch(); }