PHP code example of codejet / http

1. Go to this page and download the library: Download codejet/http library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

codejet / http example snippets

 php
$uri = new CodeJet\Http\Uri('https://www.example.com');
echo $uri;
 php
$uri = new CodeJet\Http\Factory\UriFactory('https://www.example.com');
echo $uri;
 php
$request = (new CodeJet\Http\Request())->withMethod('POST')->withUri($uri);
echo $uri;
 php
$handle = fopen('php://input','r');
$stream = new CodeJet\Http\Stream($handle);
 php
$string = "I love lamp.";
$stream = (new CodeJet\Http\Factory\StreamFactory())->createStream($string);
 php
$stream = (new CodeJet\Http\Factory\StreamFactory())->createStreamFromFile('php://input', 'r');
 php
$handle = fopen('php://input','r');
$stream = (new CodeJet\Http\Factory\StreamFactory())->createStreamFromResource($handle);