PHP code example of catpkt / http-api-gluer

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

    

catpkt / http-api-gluer example snippets


use Fenzland\HttpApiGluer\Gluer;
use Fenzland\DataParser\Transformer;
use CatPKT\Encryptor\Encryptor

$gluer= new Gluer(
	'https://url'           // URL of API.
,
	'POST'                  // Method of API.
,
	$request_transformer    // instance of Transformer.
,
	$response_transformer   // instance of Transformer.
,
	'catpkt/encryptor-php'  // content type of request
,
	'catpkt/encryptor-php'  // content type of response (optional if same with content type of request)
,
	$encryptor              // instance of Encryptor
);

// or

$gluer= Gluer::make_(
	'https://url/{path_param}'
,
	'POST'
,
	$request_transformer_meta           // meta array of Transformer.
,
	$response_transformer_meta          // meta array of Transformer.
,
	'catpkt/encryptor-php'
,
	'catpkt/encryptor-php'
,
	'encrypt-key--with-32-byte-length'  // encrypt key (optional, but 

$result= $gluer->call( $data );