PHP Classes
elePHPant
Icontem

File: example/make_a_patch_request.php

Recommend this page to a friend!
  Classes of nvb  >  PHP Service Locator Generator  >  example/make_a_patch_request.php  >  Download  
File: example/make_a_patch_request.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Service Locator Generator
Generate locator classes from configuration files
Author: By
Last change:
Date: 3 years ago
Size: 877 bytes
 

Contents

Class file image Download
<?php
/**
 * @author stev leibelt <artodeto@bazzline.net>
 * @since 2015-12-10
 */

require_once __DIR__ . '/../vendor/autoload.php';

use
Net\Bazzline\Component\Curl\Builder\BuilderFactory;
use
Net\Bazzline\Component\Curl\Dispatcher\LoggingDispatcher;

$factory = new BuilderFactory();
$factory->overwriteDispatcher(new LoggingDispatcher());
$builder = $factory->create();
$url = ($argc > 1) ? $argv[1] : 'https://httpbin.org/get';

$response = $builder->onTheUrl($url)
    ->
usePatch()
    ->
andFetchTheResponse();

echo
'content: ' . $response->content() . PHP_EOL;
echo
'content type: ' . $response->contentType() . PHP_EOL;
echo
'head lines: ' . var_export($response->headerLines(), true) . PHP_EOL;
echo
'error:' . $response->error() . PHP_EOL;
echo
'error code:' . $response->errorCode() . PHP_EOL;
echo
'status code: ' . $response->statusCode() . PHP_EOL;