title: Can't connect through WiFi, but possible through Mobile Data
body: <p>I've a <code>php</code> file named <code>test.php</code> stored in my <code>Openshift</code> server (<a href="http://phpgear-shifz.rhcloud.com/v1/test.php" rel="noreferrer">http://phpgear-shifz.rhcloud.com/v1/test.php</a>) with the below code.</p>
  
  <pre><code>&lt;?php
  echo "Hello";
  </code></pre>
  
  <p><strong>Task</strong></p>
  
  <p>I am trying to download the text from an Android application. </p>
  
  <p><strong>Problem</strong></p>
  
  <p>I am getting a <code>java.net.UnknownHostException: Unable to resolve host "phpgear-shifz.rhcloud.com": No address associated with hostname</code> while connecting  through a <code>WiFi</code> network, but everything is fine with <code>Mobile Data</code>.</p>
  
  <p><strong>Android Activity Code</strong></p>
  
  <pre><code>    @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_test);
  
          final TextView tvTest  = (TextView) findViewById(R.id.tvTest);
  
          new AsyncTask&lt;Void, Void, String&gt;() {
              @Override
              protected String doInBackground(Void... params) {
  
                  try {
                      final URL url = new URL("http://phpgear-shifz.rhcloud.com/v1/test.php");
                      final BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
                      final StringBuilder sb = new StringBuilder();
                      String line;
                      while((line = br.readLine())!=null){
                          sb.append(line).append("\n");
                      }
  
                      br.close();
                      return sb.toString();
  
                  } catch (IOException e) {
                      e.printStackTrace();
                      return "Error: "  + e.getMessage();
                  }
              }
  
              @Override
              protected void onPostExecute(String result) {
                  tvTest.setText(result);
              }
          }.execute();
  
      }
  </code></pre>
  
  <p><strong>RESPONSES</strong></p>
  
  <p><strong>on WiFi</strong></p>
  
  <p><a href="https://i.stack.imgur.com/lC8ix.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lC8ix.png" alt="onWiFi"></a></p>
  
  <p><strong>on Mobile Data</strong></p>
  
  <p><a href="https://i.stack.imgur.com/CfT4l.png" rel="noreferrer"><img src="https://i.stack.imgur.com/CfT4l.png" alt="onMobileData"></a></p>
  
  <p><strong>Question</strong></p>
  
  <p>1) Why I can't connect through the <code>WiFi network</code> where <code>Mobile Data</code> is perfectly fine ?</p>
  
  <p>2) How to solve this problem ?</p>
  
  <p><strong>NOTE:</strong> Sometime it's getting connected, sometime won't.</p>