PHP code example of pear / http2

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

    

pear / http2 example snippets


    $http = new HTTP2();
    $langs = array(
        'en'    => 'locales/en',
        'en-US' => 'locales/en',
        'en-UK' => 'locales/en',
        'de'    => 'locales/de',
        'de-DE' => 'locales/de',
        'de-AT' => 'locales/de',
    );
    $neg = $http->negotiateLanguage($langs);
    $dir = $langs[$neg];
    

    $http = new HTTP2();
    $charsets = array(
        'UTF-8',
        'ISO-8859-1',
    );
    $charset = $http->negotiateCharset($charsets);
    

    $http = new HTTP2();
    $contentType = array(
        'application/xhtml+xml',
        'application/xml',
        'text/html',
        'text/plain',
    );
    $mime = $http->negotiateMimeType($contentType);