title: Server returned HTTP response code: 403 for URL:(How do I fix this?)
body: <p>I keep keep getting the above error when I run the code below. All signs point to a problem with COOKIES from what I've read. If I am correct,how would I go about Implementing the CookieManager to fix this issue? Or how would I fix the issue if it is not an issue with COOKIES?</p>
  
  <pre><code>public class Client {
  
      public Client(){
      }
  
      String executePost(String targetURL, String urlParameters){
          URL url;
          HttpURLConnection connection = null;
  
          try{
              //Create connection
              url = new URL(targetURL);
              connection = (HttpURLConnection)url.openConnection();
              connection.setChunkedStreamingMode(0);
              connection.setRequestMethod("POST");
              connection.setRequestProperty("Content-Type", 
                      "application/x-www-form-urlencoded");
              connection.setRequestProperty("Content-Length", "" + 
                      Integer.toString(urlParameters.getBytes().length));
              connection.setRequestProperty("Content-Language", "en-US"); 
  
              connection.setUseCaches(false);
              connection.setDoInput(true);
              connection.setDoOutput(true);
  
              //send Request 
              DataOutputStream dataout = new DataOutputStream(connection.getOutputStream());
              dataout.writeBytes(urlParameters);
              dataout.flush();
              dataout.close();
  
              //get response
              InputStream is = connection.getInputStream();
              BufferedReader br = new BufferedReader(new InputStreamReader(is));
              String line;
              StringBuffer response = new StringBuffer();
  
              while((line = br.readLine()) != null){
                  response.append(line);
                  response.append('\n');
  
              }
              System.out.println(response.toString());
              br.close();
              return response.toString();
          }catch(Exception e){
              System.out.println("Unable to full create connection");
              e.printStackTrace();
              return null;
          }finally {
  
              if(connection != null) {
                  connection.disconnect(); 
              }
          }
      }
  }
  </code></pre>