1

我打算实施报价雅虎股票。当它运行时,程序没有连接到我输入的指定 url。

它在模拟器中显示一团糟white @ fault "redirect " response(301)

这是我连接到 url 的代码:

public String getQuote() throws IOException,NumberFormatException { 
String url ="http://quote.yahoo.com/d/quotes.csv?s=ibm&f=slc1wop"; 
HttpConnection c = null; 
c =(HttpConnection) Connector.open(url,Connector.READ_WRITE, true); 
c.setRequestMethod(HttpConnection.GET); 
InputStream is = c.openInputStream(); 
StringBuffer sb = new StringBuffer(); 
int ch; 
  while ((ch = is.read()) != -1) { 
    sb.append((char) ch); 
  } 
return (sb.toString()); 
} 
4

0 回答 0