title: Java send POST data to PHP server blocked by accessRules method
body: <p>I'm POST-ing some data to PHP server in Yii framework. 
      Login works fine. which means my data is prperly sent to the server.</p>
  
  <p>but after login my subsequent requests are denied by the <code>accessRules</code> method on the server and im getting the login page in response.</p>
  
  <p>This is the accessRules function in PHP. 
  Where egineering are normal users other than admins.</p>
  
  <pre><code>public function accessRules()
      {
          return array(
  
              array('allow',  // allow all users to perform 'index' and 'view' actions
                  'actions'=&gt;array('index','view','AssignedUsers',),
                  'roles'=&gt;array('admin', 'engineering'),
                  //'users'=&gt;array('*'),
              ),
              array('allow', // allow authenticated user to perform 'create' and 'update' actions
                  'actions'=&gt;array('create','update','userReport','userNewReport',),
                  'roles'=&gt;array('admin'),
                  //'users'=&gt;array('@'),
              ),
              array('allow', // allow admin user to perform 'admin' action
                  'actions'=&gt;array('admin'),
                  'roles'=&gt;array('admin', 'engineering'),
              ),
              array('allow', // allow admin user to perform 'delete' action
                  'actions'=&gt;array('delete'),
                  'roles'=&gt;array('admin', 'admin'),
              ),
              array('deny',  // deny all users
                  'users'=&gt;array('*'),
              ),
          );
      }
  </code></pre>
  
  <p>but i get denied by the server.</p>
  
  <p>this is JAVA request </p>
  
  <pre><code>String content ="user=" + URLEncoder.encode(userId,encoding) +
  "&amp;apiKey=" + URLEncoder.encode(apiKey,encoding);  
  </code></pre>
  
  <p>this content is used in following with a url.</p>
  
  <pre><code>        connection = (HttpURLConnection)url.openConnection();
          connection.setRequestMethod("POST");
          connection.setDoInput(true);
          connection.setDoOutput(true);
          connection.setUseCaches (false);
          connection.setRequestProperty("Content-length",String.valueOf (content.length())); 
          connection.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
  
          DataOutputStream printout = new DataOutputStream (connection.getOutputStream ());
  
          System.out.println(url+",Content = "+content);
  
          printout.writeBytes (content);
          printout.flush ();
          printout.close ();
  </code></pre>