Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. $client = new Client();
  2. $response = $client->request('GET', 'https://api.cinelist.co.uk/get/times/cinema/10565', [
  3. 'json' => [
  4. 'title' => '',
  5. 'times' => ''
  6. ]
  7. ]);
  8.  
  9. $api_response = $response->getBody();
  10. $data = json_decode($api_response);
  11. // dd($data);
  12.  
  13. foreach ($data['films'] as $film) {
  14. $move = new Film();
  15. $title = $film->title;
  16. $time = implode(', ', $film->times);
  17.  
  18.  
  19. $move::updateOrCreate([
  20. 'title' => $title,
  21. 'times' => $time
  22. ]);
  23. $move ->save();
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement