Support the ongoing development of Laravel.io →
Requests IOC Laravel.io

I 'm trying to create a very simple Laravel web service for my mobile app but I have no idea why Laravel can't return result for my mobile app. Here is the simple code

routes.php Route::get('/', 'PagesController@home');

PagesController.php public function home() { return Response::json(array('name' => 'Steve', 'state' => 'CA')); }

In my browser, i type in http://localhost:8000 and it successfully return the result for me as below

{"name":"Steve","state":"CA"}

So, i thought that my web service has been successfully done but when I try to use my mobile app to access, it return blank. I use my mobile app to access online free json web service such as http://date.jsontest.com, it return result without any problem. So, I 'm sure is my problem. What had I done wrong?

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

tlteoh tlteoh Joined 19 Sep 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.