import java.io.*;
import java.net.*;
import javax.swing.text.html.parser.Parser;
public class TCP_HTTP {
public static void main(String[] args) throws Exception, IOException
{
// TODO Auto-generated method stub
String FromServer;
Socket clientSocket = new Socket("weather.yahooapis.com", 80);
PrintWriter outToServer = new PrintWriter(
clientSocket.getOutputStream(),true);
outToServer.println("GET http://weather.yahooapis.com/forecastrss?w=2449323");
BufferedReader inFromServer = new BufferedReader(
new InputStreamReader(clientSocket.getInputStream()));
Thread.sleep(1000);
while ((FromServer = inFromServer.readLine())!=null)
{
String temperature = FromServer.toString();
if(FromServer.indexOf("yweather:condition")== 1)
{
//FromServer.contentEquals("yweather:condition");
System.out.println(temperature);
}
// System.out.println("Received:" + FromServer.indexOf("yweather:condition"));
}
clientSocket.close();
}
}