String sourceUrlString="http://www.url.com";
String result = postData(sourceUrlString);
public String postData(String url){
// Create a new HttpClient and Post Header
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
try {
// Add your data
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
nameValuePairs.add(new BasicNameValuePair("p", "bm02new"));
nameValuePairs.add(new BasicNameValuePair("town", "¿¿¿¿¿"));
nameValuePairs.add(new BasicNameValuePair("addr", ""));
nameValuePairs.add(new BasicNameValuePair("code", "0"));
nameValuePairs.add(new BasicNameValuePair("bank", "0"));
nameValuePairs.add(new BasicNameValuePair("submit", "ok"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
HttpResponse response = httpclient.execute(httppost);
InputStream is = response.getEntity().getContent();
BufferedInputStream bis = new BufferedInputStream(is);
ByteArrayBuffer baf = new ByteArrayBuffer(20);
int current = 0;
while((current = bis.read()) != -1){
baf.append((byte)current);
}
/* Convert the Bytes read to a String. */
String text = new String(baf.toByteArray());
return text;
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
} catch (IOException e) {
// TODO Auto-generated catch block
}
String text = null;
return text;
}
<html>
<head>
......
</head>
<body>
.......
.......
<table cellspacing="0" cellpadding="2" border="0">
<tbody>
<tr bgcolor="#3493e0">
<td width="90">
<img height="1" width="90" border="0" src="space.gif"><br>
<span class="smallw"><b>¿¿¿¿¿¿¿¿<br> ¿¿¿¿¿</b></span>
</td>
<td><img height="1" width="10" border="0" src="space.gif"></td>
<td width="160"><img height="1" width="160" border="0" src="space.gif"><br>
<span class="smallw"><b>¿¿¿¿¿</b></span>
</td>
<td><img height="1" width="10" border="0" src="space.gif"></td>
<td width="145"><img height="1" width="145" border="0" src="space.gif"><br>
<span class="smallw"><b>¿¿¿¿¿</b></span></td>
<td><img height="1" width="10" border="0" src="space.gif">
</td>
<td width="125"><img height="1" width="125" border="0" src="space.gif"><br>
<span class="smallw"><b>¿¿¿¿¿¿, ¿¿¿¿¿¿¿¿¿<br> 14.06.2010, 18:00</b></span>
</td>
</tr>
<tr height="42" bgcolor="#eeeeee">
<td><span class="normal">[b]DATA1[/b]</span></td>
<td></td>
<td><span class="normal">[b]DATA2[/b]</span></td>
<td></td>
<td><span class="normal">[b]DATA3[/b]</span></td>
<td></td>
<td align="center">
<span class="small"><a href="[b]URLDATA[/b]" onclick="window.open('','bmDetails056118','toolbar=no,location=no,menubar=no,directories=no,status=no,resizable=no,scrollbars=no,width=400,height=600, titlebar=no');" target="bmDetails056118"><img border="0" src="/magnifier.gif" alt="¿¿¿¿¿¿"></a></span></td>
</tr>
<tr height="42" bgcolor="">
<td><span class="normal">[b]DATA1[/b]</span></td>
<td></td>
<td><span class="normal">[b]DATA2[/b]</span></td>
<td></td>
<td><span class="normal">[b]DATA3[/b]</span></td>
<td></td>
<td align="center"> <span class="small"><a href="[b]URLDATA[/b]" onclick="window.open('','bmDetails643001','toolbar=no,location=no,menubar=no,directories=no,status=no,resizable=no,scrollbars=no,width=400,height=600, titlebar=no');" target="bmDetails643001"><img border="0" src="/magnifier.gif" alt="¿¿¿¿¿¿"></a></span></td>
</tr>
...............
...............
...............
</tbody>
</table>
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE