php - My request with GuzzleHttp stagnates -


hi trying consume api guzzlehttp stagnates.(loading infinite in browser)

technologies:

  1. laravel 5.2
  2. guzzlehttp 6.0

usercontroller.php

<?php  namespace app\http\controllers;  use app\user; use illuminate\http\request; use app\http\requests; use illuminate\support\facades\input;  use guzzlehttp\client guzzlehttpclient; use guzzlehttp\exception\requestexception;      public function index() {         try {              $client = new guzzlehttpclient();              $apirequest = $client->request('get', 'localhost:8000/api');              $content = json_decode($apirequest->getbody()->getcontents());             dd($content);          } catch (requestexception $re) {             dd($re);         }     } } 

note: when test postman, ok.

image postman ok

what think

i sure problem is:

$apirequest = $client->request('get', 'localhost:8000/api');

but don't know why.

maybe data important web running in localhost(because don't know if there interference if have web , , api in same web):

localhost:8000/home

routes.php

<?php  route::get('/', function () {     return view('auth/login'); }); route::auth();  route::get('home', 'usercontroller@index'); route::resource('api', 'apicontroller'); 

any suggestions?


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -