PHP code example of mykehowells / httpeep

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

    

mykehowells / httpeep example snippets


set__autoload_extensions('.class.php');
spl_autoload_register();

$client = new \HttPeep\Client( 'https://api.example.com' );

$response = $client->post( "/user/auth", [
     'token' => $_SESSION['api']['token'],
     'username' => $_POST['username'],
     'password' => md5( $_POST['password'] )
] );

var_export( $response );

$client = new \HttPeep\Client( 'https://api.example.com' );

$response = $client->post( "/user/auth", [
     'token' => $_SESSION['api']['token'],
     'username' => $_POST['username'],
     'password' => md5( $_POST['password'] )
] )->json();

var_export( $response );

$client = new \HttPeep\Client( 'https://api.example.com', [
    'curl' => [
        'followlocation' => true, // CURLOPT_FOLLOWLOCATION - follow any Location: header sent as part of the HTTP header
        'maxredirs' => 10 // CURLOPT_MAXREDIRS - Maximum number of HTTP redirections to follow
    ]
] );
require 'vendor/autoloader.php'