Last active
August 4, 2018 19:34
-
-
Save joelsteidl/4b5599ccd6a9f7ad5d70d69eac8a7f63 to your computer and use it in GitHub Desktop.
Guzzle is part of Drupal 8 as Drupal::httpClient();
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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