从千禧一代媒体广告服务器获取请求



嗨,我试图从千禧一代媒体发出GET请求,要求在我的黑莓java应用程序中显示广告,但我似乎无法实现。这就是我的

HttpConnection conn = null;             
InputStream in = null;             
StringBuffer buff = new StringBuffer();             
String result = ""; 
String url ="http://ads.mydas.mobi/getAdapid=157899&auid=ddd25abbb993f79454b12827c803fbafab2ad89b&ua";                          try {                 
conn = (HttpConnection) new ConnectionFactory().getConnection(url).getConnection(); conn.setRequestMethod(HttpConnection.GET);                 
conn.setRequestProperty("User-Agent",              
"Profile/MIDP-1.0 Confirguration/CLDC-1.0");                 
if (conn.getResponseCode() == HttpConnection.HTTP_OK) {                     
in = conn.openInputStream();                     
// parser.parse(in, handler);                  
buff.append(IOUtilities.streamToBytes(in));                     
result = buff.toString();                 
} else {                     
result = "Error in connection" + conn.getResponseCode();
((SettingWaitScreen)screen).update(result);              
} catch (Exception ex) {                 
ex.printStackTrace();             
} finally {                 
try {                     
if (in != null) {                         
in.close();                     
}                     
conn.close();                 
} catch (IOException e) {                     
e.printStackTrace();                 
}             
}

我不知道这是否是正确的方法,我们非常感谢您对做这个广告请求的任何帮助。这是我从网站上得到的http://docs.millennialmedia.com/S2S/ad-request.html

嘿,您使用的基本URL不正确。

请使用以下URL进行检查http://ads.mp.mydas.mobi/getAd?apid=157899&auid=ddd25abb993f79454b12827c803fbafab2ad89b

上述URL也可以在浏览器中使用。

最新更新