PHP code example of kiwfy / request-service-php

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

    

kiwfy / request-service-php example snippets


use RequestService\Request;
$config = [
	'your-service' => [
		'url' => 'https://jsonplaceholder.typicode.com',
	],
];
$sample = new Request($config);
$response = $sample->sendRequest(
	'your-service',
	'GET',
	'todos/1'
);
var_dump($response);

use RequestService\Request;
$config = [
	'your-service' => [
		'url' => 'https://developer.marvel.com/',
		'json' => false,
	],
];
$sample = new Request($config);
$header = [
	'stream' => true,
];
$response = $sample->sendRequest(
	'your-service',
	'GET',
	'docs',
	$header
);
var_dump($response);
sh
php sample/request-sample.php
php sample/request-image-sample.php