mercredi 31 août 2016

POST data from android using Volley to Laravel5

I'm having problems on what URL to be used to link to the php scripts in Laravel5 which I'm running at localhost at the moment. I have created a function in my controller to handle the request. Here is the function:

    public function mobile_validator(Request $request) {
    $method = $request->method();
    if($method == 'POST') {
        $username = $request->username;
        $password = $request->password;
        $user = DB::table('users')->get();
        foreach($user as $i) {
            if($username == $i->email and $password == $i->password) {
                return 'success';
            }
            else {
                return 'failure';
            }
        }
    }   

I have also created a route in my route.php.

Route::get('/mobilevalidator', 'AuthController@mobile_validator');

This is my URL in android:

private static final String LOGIN_URL = "http://ift.tt/2ca9c06";

Now when I login in my app it displays the error com.android.volley.timeouterror

Is the URL correct in defining the php script in Laravel?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2bSeLj9
via IFTTT

Aucun commentaire:

Enregistrer un commentaire