PHP code example of hanwenbo / fetch

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

    

hanwenbo / fetch example snippets


$client = new \hanwenbo\fetch\Fetch();
	$res    = $client->request( 'GET', 'https://www.baidu.com', [
    'header'=>[
			'test'=>1
		],
		'query' => [
			'adada' => 121212,
		],
	] );

$client = new \hanwenbo\fetch\Fetch();
	$res    = $client->request( 'POST', 'https://www.baidu.com', [
    'header'=>[
			'test'=>1
		],
		'form_params' => [
			'adada' => 121212,
		],
	] );

$client = new \hanwenbo\fetch\Fetch();
	$res    = $client->request( 'POST', 'https://www.baidu.com', [
    'header'=>[
			'test'=>1
		],
		'body' => [
			'adada' => 121212,
		],
	] );

php tests/fetch.php