Skip to content

Instantly share code, notes, and snippets.

@joelsteidl
Last active August 4, 2018 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joelsteidl/4b5599ccd6a9f7ad5d70d69eac8a7f63 to your computer and use it in GitHub Desktop.
Save joelsteidl/4b5599ccd6a9f7ad5d70d69eac8a7f63 to your computer and use it in GitHub Desktop.
Guzzle is part of Drupal 8 as Drupal::httpClient();
<?php
// See https://jobs.github.com/api for documentation.
$client = \Drupal::httpClient();
$params = [
'query' => [
'description' => 'laravel',
'full_time' => true,
]
];
$request = $client->get('https://jobs.github.com/positions.json', $params);
$response = $request->getBody()->getContents();
$jobs = json_decode($response);
foreach ($jobs as $job) {
print_r($job->company . ' - ' . $job->location);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment