javascript - How to get data from RESTful API using GuzzleHttp and Laravel -


i have been on while, hope kindly out @ time. shown in below code, when directly point endpoint browser right response - meaning data endpoint. so, trying use guzzle query/consume api, surprise, not return based on documentation followed on guzzle website. how done? please help.

public function create()     {         $client = new client([             'base_uri' => 'http://localhost:8800',             'headers' => [                 'accept' => 'application/json; charset=utf-8',                 'type' => 'get',                 'crossdomain' => true,                 'datatype' => 'jsonp'             ]         ]);          $promises = [             'dialects'      => $client->getasync('/dialects'),             'languages'     => $client->getasync('/languages'),         ];         $results = promise\unwrap($promises);         $results = promise\settle($promises)->wait();          echo $results['dialects']->getheader('content-length');         echo $results['languages']->getheader('content-length');         return view('pages.songs.index')->with('results', $results['dialects']);     } 

this index.blade.php code: $results

it returns error:

fatalthrowableerror in mediacontroller.php line 51: call member function getheader() on array 


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -