Installing Guzzle #PHP

“Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and trivial to integrate with web services.”

http://docs.guzzlephp.org/en/latest/index.html
And from my .bash_history, the installation process

curl -sS https://getcomposer.org/installer | php
php composer.phar require guzzlehttp/guzzle:~6.0

To Contribute to Guzzle:
git clone https://github.com/guzzle/guzzle.git
cd guzzle && curl -s http://getcomposer.org/installer | php && ./composer.phar install –dev
make test
sudo make test
node
sudo node
brew install node
node -v
brew update
make test


and you can write a simple PHP script as below to access Github
I tried the code as below with real Github user accounts and the code works.

request(‘GET’, ‘https://api.github.com/user’, [
‘auth’ => [‘user-name’, ‘password’]
]);
echo $res->getStatusCode();
// “200”
echo $res->getHeader(‘content-type’);
// ‘application/json; charset=utf8′
echo $res->getBody();
// {“type”:”User”…’

// Send an asynchronous request.
$request = new GuzzleHttpPsr7Request(‘GET’, ‘http://httpbin.org’);
$promise = $client->sendAsync($request)->then(function ($response) {
echo ‘I completed! ‘ . $response->getBody();
});
$promise->wait();

From: http://sitestree.com/?p=4655
Categories:PHP
Tags:
Post Data:2016-11-28 22:55:29

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada