2017 © Pedro Peláez
 

library simplehttpclient

A very simple Http Client that works on PHP 5.3

image

fabricekabongo/simplehttpclient

A very simple Http Client that works on PHP 5.3

  • Wednesday, March 8, 2017
  • by fabricekabongo
  • Repository
  • 1 Watchers
  • 0 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

simplehttpclient

A very simple Http Client that works on PHP 5.3, (*1)

Installation

To install simply run this :, (*2)

    composer require fabricekabongo/simplehttpclient

Usage

This client offers 3 interfaces:, (*3)

Get request

without query parameters:, (*4)

$client = new FabriceKabongo\Http\HttpClient();
$responseData = $client->get('http://www.google.com');

or with query parameters:, (*5)

$client = new FabriceKabongo\Http\HttpClient();
$responseData = $client->get('http://www.google.com', array('q' => 'tallest falls in africa');//http://www.google.com?q=tallest%20falls%20in%20africa

post Request

with post parameters:, (*6)

$client = new FabriceKabongo\Http\HttpClient();
$responseData = $client->post('http://www.myawesomeapi.com', array('foo' => 'bar');

base64 upload

sends a file using base64 content (think android developers lol):, (*7)

touch myfile.txt && echo "random content" > myfile.txt

then:, (*8)

$client = new FabriceKabongo\Http\HttpClient();
try {
    $responseData = $client->base64Upload('http://www.myawesomeapi.com', __DIR__."/myfile.txt");
} catch (\Exception $ex) {
    //log oups
}

other informations

This code need php-curl to be installed (obviously you choose php5.3-curl, php5.6-curl php7.0-curl depending of your version), (*9)

License

MIT. you are free dude., (*10)

The Versions

08/03 2017

dev-master

9999999-dev

A very simple Http Client that works on PHP 5.3

  Sources   Download

MIT

by Fabrice Kabongo

08/03 2017

v0.3.0

0.3.0.0

A very simple Http Client that works on PHP 5.3

  Sources   Download

MIT

by Fabrice Kabongo

08/03 2017

v0.2.1

0.2.1.0

A very simple Http Client that works on PHP 5.3

  Sources   Download

MIT

by Fabrice Kabongo

02/03 2017

0.1.1

0.1.1.0

A very simple Http Client that works on PHP 5.3

  Sources   Download

MIT

by Fabrice Kabongo

02/03 2017

0.1.0

0.1.0.0

A very simple Http Client that works on PHP 5.3

  Sources   Download

MIT

by Fabrice Kabongo