Hello guys i am using laravel 3, i want to make post request to laravel 3 controller. here is coontroller users.php
class Users_Controller extends Base_Controller
{
public $restful = true;
public function post_signin()
{
print("request success");
}
}
Here is routes.php
Route::get('signin', array('as'=>'signin','uses'=>'users@signin'));
Route::post('signin', array('uses'=>'users@signin'));
here is android post request
httppost= new HttpPost("http://test.com/signin");
test.com is local domain i am using through host file. what url should i enter in android to make post request? so that it can go to users.php and execute post_signin method of that file.
i tried following
1) httppost= new HttpPost("http://test.com/signin"); (as per my route of routes.php)
2)httppost= new HttpPost("http://localhost/androidtest/application/controller/users.php");
3) httppost= new HttpPost("http://test.com/users/signin");
(as per this referance (http://stackoverflow.com/questions/16137851/url-to-do-request-on-laravel)
Based on your comment you are executing request two times but with different methods (execute). You just need one execute in order to make request to server. You are also using response variable as string and as HttpResponse object.
Please try to use code below to make your request, change url with your url