Hello,

I did a pagerank application but unfortunately it does not posting the url to the server.

Can anyone have a look to my code and tell me what im missing ? !

Thanks in advance!

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.ObjectOutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
 
public class pageRank {
  
        private static final String ENCODE = "www.w3c.org";
 
        public void rankSearch() throws MalformedURLException, IOException{
                URL url;
                DataOutputStream prtout;
                BufferedReader input;
                url =new URL("http://www.wmhaven.com/page.php?page=PageRankChecker");
                HttpURLConnection urlConnection = (HttpURLConnection)url.openConnection();
                urlConnection.setDoInput(true);
                urlConnection.setDoOutput(true);
                urlConnection.setUseCaches(false);
                urlConnection.setRequestMethod("POST");
                
            final String content = ENCODE;                      
 
                prtout = new DataOutputStream( urlConnection.getOutputStream() );
                prtout.writeBytes (content);
                prtout.flush ();
                prtout.close ();
                                             
                ObjectOutputStream output;
 
                input = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
                output = new ObjectOutputStream(new FileOutputStream( "result.html" ));
 
                String line;
                while( null != ((line = input.readLine()))) {
                        output.writeObject(line);
                        System.out.println(line);
                }
                input.close ();
                output.close();
 
        }
        
 
   public static void main(final String[] args) throws Exception {
 
          pageRank search;
          search = new pageRank();
          search.rankSearch();
  }
}
This question has already been answered. Start a new discussion instead.