Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. <?php
  2.  
  3. namespace AppBundleController;
  4.  
  5. use SymfonyBundleFrameworkBundleControllerController;
  6. use SensioBundleFrameworkExtraBundleConfigurationRoute;
  7. use SymfonyComponentHttpFoundationResponse;
  8. use SymfonyComponentHttpFoundationRequest;
  9. use PsrHttpMessageResponseInterface;
  10. use GuzzleHttpClient;
  11.  
  12. class ScheduleController extends Controller {
  13.  
  14. /**
  15. * @Route("/schedule")
  16. */
  17.  
  18. public function getJobs() {
  19. // Create a client with a base URI
  20. $client = new GuzzleHttpClient(['base_uri' => 'http://my.external.api/']);
  21. // Send a request to http://my.external.api/site/67/module/1449/item
  22. $response = $client->request('GET', 'site/67/module/1449/item', ['auth' => ['*****', '*****']]);
  23. return $this->json(array($response));
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement