title: How to implement Login with HttpURLConnection and PHP server in Android
body: <p>I have a Web Service which has login functionality,  connecting to a PHP back end: </p>
  
  <blockquote>
    <p>Htp://hfbhgvbbnvhn.com/mypictures/loginService.php   (its in fact http)</p>
  </blockquote>
  
  <p>I have to send two parameters to it and in return I would get the JSONObject. But right now I am trying to use the HttpUrlConnection object to connect to the PHP service, but I have no idea to how to send the parameters. I have searched many solutions but they all are working on NameValuePair with DefaultHttpClient where as I think I have to send two separate strings as a parameters. So How can I convert <a href="https://stackoverflow.com/questions/10312728/call-php-function-from-android#">this</a> code to an implementation that uses HttpURLConnection instead of DefaultHttpClient, now that DefaultHttpClient is deprecated in Api 22? </p>