title: Java HTTP Request for PHP
body: <p>So i am trying to send some variables to my localhost which runs a php file which should output the variable.</p>
  
  <pre><code>URL url = null;
  try {
      String charset = "UTF-8";
      String MontagMittagVorspeise = "value1";
      String query = String.format("param1=%s", URLEncoder.encode(MontagMittagVorspeise, charset));
      url = new URL("127.0.0.1/Haunsbot/Hauns.php");
      URLConnection connection = new URL(url + "?" + query).openConnection();
      connection.setRequestProperty("Accept-Charset", charset);
      InputStream response = connection.getInputStream();
  } catch (MalformedURLException e) {
      e.printStackTrace();
  } catch (IOException e) {
      e.printStackTrace();
  }
  </code></pre>
  
  <p>And this is my PHP:</p>
  
  <pre><code>&lt;?php 
  if(isset($_GET["MontagMittagVorspeise"]))
  {echo "Vehicle :".$_GET["MontagMittagVorspeise"];}
  ?&gt;
  </code></pre>
  
  <p>And IntelliJ gives me the following error: <code>java.net.MalformedURLException: no protocol: 127.0.0.1/Haunsbot/Hauns.php</code></p>
  
  <p>Can someone help me?:)</p>