PHP code example of bee4 / transport

1. Go to this page and download the library: Download bee4/transport 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/ */

    

bee4 / transport example snippets



$client = new Bee4\Transport\MagicHandler();
$request = $client->get('http://www.example.com', ['Accept: text/html']);
$response = $request->send();

$respose->getStatusMessage(); //Retrieve the status definition example: 301 Moved Permanently
$respose->getBody(); //Retrieve response content

//The same is possible with FTP
$request = $client->head('ftp://user@pass:host.com/path')->send();
//Remove a file
$client->delete('ftp://user@pass:host.com/path/to/file.php')->send();

//And SFTP - Upload a file
$client->put('sftp://user@pass:host.com/path/to/file.php')
  ->setBody('File content here')
  ->send();