How to use Guzzle on Codeigniter? How to use Guzzle on Codeigniter? codeigniter codeigniter

How to use Guzzle on Codeigniter?


Check this link:

https://github.com/rohitbh09/codeigniter-guzzle

  $this->load->library('guzzle');  # guzzle client define  $client     = new GuzzleHttp\Client();  #This url define speific Target for guzzle  $url        = 'http://www.google.com';  #guzzle  try {    # guzzle post request example with form parameter    $response = $client->request( 'POST',                                    $url,                                   [ 'form_params'                                         => [ 'processId' => '2' ]                                   ]                                );    #guzzle repose for future use    echo $response->getStatusCode(); // 200    echo $response->getReasonPhrase(); // OK    echo $response->getProtocolVersion(); // 1.1    echo $response->getBody();  } catch (GuzzleHttp\Exception\BadResponseException $e) {    #guzzle repose for future use    $response = $e->getResponse();    $responseBodyAsString = $response->getBody()->getContents();    print_r($responseBodyAsString);  }