Advertisement
Guest User

Untitled

a guest
Apr 4th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. $username = env('API_USERNAME');
  2. $password = env('API_PASSWORD');
  3.  
  4. $credentials = base64_encode($username.':'.$password);
  5.  
  6. $client = new Client([
  7. // Base URI is used with relative requests
  8. 'base_uri' => 'https://api.amorc.org.br/v1/',
  9. ]);
  10.  
  11. try {
  12. // $query = http_build_query($vars, null, '&');
  13. $params = "seq_cadast_oa_atuaca=258461";
  14.  
  15. @$response = $client->request('PUT', "membros/144343/1",
  16. [
  17. 'verify' => false,
  18. 'headers' => ['Authorization' => 'Basic ' . $credentials],
  19. 'query' => $params
  20. ]);
  21.  
  22. $content = $response->getBody()->getContents();
  23.  
  24. $obj = \GuzzleHttp\json_decode($content, false);
  25.  
  26. return $obj;
  27.  
  28. }catch (\Exception $e){
  29. throw new WebServiceException();
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement