PHP Classes

File: examples/04-post.php

Recommend this page to a friend!
  Classes of Sergey Shuchkin   React PHP HTTP Client   examples/04-post.php   Download  
File: examples/04-post.php
Role: Example script
Content type: text/plain
Description: Example script
Class: React PHP HTTP Client
Process HTTP request responses asynchronously
Author: By
Last change:
Date: 5 years ago
Size: 466 bytes


Class file image Download

require_once __DIR__ . '/../vendor/autoload.php';

$loop = \React\EventLoop\Factory::create();

$http = new \Shuchkin\ReactHTTP\Client( $loop );

$http->post( '', '{"name": "morpheus","job": "leader"}' )->then( function ( $content ) {


}, function ( \
Exception $ex ) {

'HTTP error '.$ex->getCode().' '.$ex->getMessage();

} );

//$http->on('debug', function( $s ) { echo trim($s).PHP_EOL; } );