title: How to read JSON from api url with laravel 5.5
body: <p>How to read JSON from api url with laravel 5.5 while maintaining the MVC format.</p>
  
  <p>I have searched a lot about it but could not find any on point answer.</p>
  
  <p>There are lots of ways to read/post JSON using ajax, but that will harm the architecture, so I want to use controller to parse JSON and then pass to view.
  or maybe is there a way to parse json into model first ?</p>
  
  <p>There is also a plain solution of decoding JSON though simple php like this :</p>
  
  <pre><code>$rUrl = 'http://example.com/api/products';
  
  $data = json_decode(file_get_contents($rUrl), true);
  
  return view('mydata')-&gt;withData($data);
  </code></pre>
  
  <p>But Is there any better way to handle this in laravel ?
  and in which other ways I can maintain header and JSON results in laravel ?</p>
  
  <p>is my question is not clear please comment to correct it.
  any help would be appreciated. 
  Thanks in Advance !</p>