1. install
    php composer.phar require guzzlehttp/guzzle:~6.0
  2. Example Code
     $body = json_encode(array(‘id’=>122,’name’=>’Mr.Jonh’));
  $client = new Client([‘headers’=>[‘Content-Type’=>’application/json’]]);
  $response = $client->request(‘POST’, ‘http://localhost/restapi/public/api/customer’,[‘body’=>$body]);
  return $response->getBody();
Advertisements