PHP code example of pickmap / service-request

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

    

pickmap / service-request example snippets


KEYCLOAK_CLIENT_ID=client-id
KEYCLOAK_CLIENT_SECRET=keycloak-secret-key
KEYCLOAK_USERNAME=usernameOrEmail
KEYCLOAK_PASSWORD=password
KEYCLOAK_LOGIN_URL='https://...openid-connect/token?grant_type=password'

class  sample {
use  ServiceRequest;

public  function  aMethod()
	{
		self::requestPost('https:://service.com/list');
	}
}

//If $refreshToken is equal to true, the token will be refreshed regardless of the cache
self::getToken($refreshToken);

self::requestToKeyCloak();

/*
Authorization is set in all tokens, but with this method, it is overwritten by the third parameter of post and get methods.
*/
self::HeadersProcess($newHeader);

self::requestPost(string  $url,array  $data  = [],$headers  = []);

self::requestGet(string  $url,array  $data  = [],$headers  = []);