PHP code example of xp-framework / http

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

    

xp-framework / http example snippets


use peer\http\HttpConnection;

$c= new HttpConnection('http://xp-framework.net/');
Console::writeLine($c->head());

with ($c= new HttpConnection('http://xp-framework.net/')); {
  $response= $c->get();
  Console::writeLine('Response: ', $response);
  
  $in= $response->in();
  while ($in->available()) {
    $bytes= $in->read();
  }
}

$c= new HttpConnection('https://example.com/');