Current stock price by using sockets in java

Posted by user2976396 on Stack Overflow See other posts from Stack Overflow or by user2976396
Published on 2013-11-10T15:48:09Z Indexed on 2013/11/10 15:53 UTC
Read the original article Hit count: 181

Filed under:

My program is to find the current stock price of a symbol ..this is the code which i m using `String yahoo = "finance.yahoo.com" ; final int httpd = 80; Socket sock = new Socket(yahoo,httpd);

PrintWriter out   = new PrintWriter( sock.getOutputStream(), true );
BufferedReader in =new BufferedReader(new InputStreamReader( sock.getInputStream() ) );
out.println( "GET http://finance.yahoo.com/q?s=ibm&f=1l HTTP/1.0\r\n\r\n " );
out.println("");
out.flush();`

I am just getting the output as ibm .Can anyone please suggest how to get the price.

© Stack Overflow or respective owner

Related posts about sockets