my android function : im sure that there is no problem with MAP i put in the function

    public class WebServiceController extends  AsyncTask<WebServiceProperties, Void,   String> {

public static String makeRequest(String path, Map<?, ?> params ) throws Exception {

     HttpParams httpParameters = new BasicHttpParams();
        int timeoutConnection = 10000;
        HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);
        DefaultHttpClient httpclient = new DefaultHttpClient(httpParameters);

        // url with the post data
        HttpPost httpost = new HttpPost(path);

        // convert parameters into JSON object
        JSONObject holder = new JSONObject(params);

        // passes the results to a string builder/entity
        StringEntity se = new StringEntity(holder.toString());

        // sets the post request as the resulting string
        httpost.setEntity(se);

        // sets a request header so the page receiving the request
        // will know what to do with it
        httpost.setHeader("Accept", "application/json");
        httpost.setHeader("Content-type", "application/json");


        // Handles what is returned from the page
        ResponseHandler<String> responseHandler = new BasicResponseHandler();
        String httpResponse = httpclient.execute(httpost, responseHandler);
        return httpResponse;
  }


 @Override
 protected String doInBackground(WebServiceProperties... params) {
// TODO Auto-generated method stub
int count = params.length;
for (int i = 0; i < count; i++) {
    WebServiceProperties sp=params[i];
    try {
        return makeRequest(sp.getPath(), sp.getParams());
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
return null;
 }



   }

this is my PHP controller :

 <?php

class ServiceController extends Zend_Controller_Action
{

public function init()
{

     $this->_response->setHeader('Content-Type', 'appication/json');
    $this->_response->setHeader('Access-Control-Allow-Origin', '*');
    $this->_response->setHeader('Access-Control-Max-Age', '3628800');
    $this->_response->setHeader('Access-Control-Allow-Methods', ' GET, POST, PUT,   DELETE');
    $this->_helper->viewRenderer->setNoRender(true);
    $this->_helper->layout->disableLayout(); 
  }

   public function indexAction()
  {



  }


  public function getVenuesAction()
  {
    $M_Venue = new Model_Venues();
    $venues = $M_Venue->selectVenuesDetails();
    echo Zend_Json::encode($venues);
  }
  public function getAuthAction()
  {
    $msg="";
    $res=false;
    $method=$_SERVER['REQUEST_METHOD'];
    try{
        $password=$_POST['password'];
        $venue_id=$_POST['venue_id'];
        $realpassword=md5($password);
        $mvenue=new Model_Venues();
        $venueRes=$mvenue->venueAuth($venue_id, $realpassword);
        $res=($venueRes)?true:false;
    }  catch (Exception $exc)
    {
        $msg=$exc->getMessage();
    }
    echo Zend_Json::encode(array("success"=>$res,'msg'=>$msg,'method'=>$method));
  }

}

$_POST['password'] and $_POST['venue_id'] throw "undefined index";

this is a photo captured when i debug params enter image description here

Related posts

Recent Viewed