PHP code example of sumeko / http-exception

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

    

sumeko / http-exception example snippets

 
    /**
     * @var \Exception $e 
     */
    $e->getCode();
    // 502
 
    /**
     * @var \Exception $e
     */
    $e->getMessage();
    // Bad Gateway
 
    /**
     * @var \Exception $e
     */
    $e->getExplanation();
    // Indicates that the server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request.
 
    /**
     * @var \Exception $e
     */
    $e->getSpec();
    // RFC7231#6.6.3
 
    /**
     * @var \Exception $e
     */
    $e->getReference();
    // http://tools.ietf.org/html/rfc7231#section-6.6.3
 
    /**
     * @var \Exception $e
     */
    $e->getStatus() 
    // 502 Bad Gateway