http://outlet.lenovo.com/laptops.html?
cpu_speed=39& - 3 ghz
cpu_type=183& - i7
hdd_capacity=87& - 750gb
memory_capacity=103& - >4 gb
price=2%2C200& - < $400
optical_storage_type=179 - bluray
needed:
http://outlet.lenovo.com/laptops.html?cpu_speed=39&cpu_type=183&hdd_c
apacity=87&memory_capacity=103&price=2%2C200&optical_storage_type=179
To see if any items are there:
"category-products"
To see if price is listed:
"price-box"
To see if this is a reduced price:
"special-price"
To see if the item is available:
"Add to Cart"
To get the URL of "add to cart":
setLocation('
not needed:
http://outlet.lenovo.com/laptops.html?cpu_speed=39&cpu_type=182&hdd_capacity=87&memory_capacity=104&optical_storage_type=178&price=2%2C200
http://outlet.lenovo.com/checkout/cart/add/uenc/aHR0cDovL291dGxldC5sZW5vdm8uY29tL2xhcHRvcHMuaHRtbD9jcHVfc3BlZWQ9MzkmY3B1X3R5cGU9MTgyJmhkZF9jYXBhY2l0eT04NyZtZW1vcnlfY2FwYWNpdHk9MTA0Jm9wdGljYWxfc3RvcmFnZV90eXBlPTE3OCZwcmljZT0yJTJDMjAw/product/25731/
http://outlet.lenovo.com/checkout/cart/add/uenc/aHR0cDovL291dGxldC5sZW5vdm8uY29tL2xhcHRvcHMuaHRtbD9jcHVfc3BlZWQ9MzkmY3B1X3R5cGU9MTgyJmhkZF9jYXBhY2l0eT04NyZtZW1vcnlfY2FwYWNpdHk9MTA0Jm9wdGljYWxfc3RvcmFnZV90eXBlPTE3OCZwcmljZT0yJTJDMjAw/product/35469/
=====================================================
package org.kodejava.example.net;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
public class UrlReadPageDemo {
public static void main(String[] args) {
try {
URL url = new URL("http://www.kodejava.org");
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
BufferedWriter writer = new BufferedWriter(new FileWriter("data.html"));
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
writer.write(line);
writer.newLine();
}
reader.close();
writer.close();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
====================================
I did the download a web page with the HttpURLConnection.getInputStream() and to get the content to a String, i do the following method:
String content="";
isr = new InputStreamReader(pageContent);
br = new BufferedReader(isr);
try {
do {
line = br.readLine();
content += line;
} while (line != null);
return content;
} catch (Exception e) {
System.out.println("Error: " + e);
return null;
}
==========================================
URL url;
InputStream is = null;
DataInputStream dis;
String line;
try {
url = new URL("http://stackoverflow.com/");
is = url.openStream(); // throws an IOException
dis = new DataInputStream(new BufferedInputStream(is));
while ((line = dis.readLine()) != null) {
System.out.println(line);
}
} catch (MalformedURLException mue) {
mue.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
try {
is.close();
} catch (IOException ioe) {
// nothing to see here
}
}
=================================================
//set CLASSPATH=%CLASSPATH%;activation.jar;mail.jar
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
No comments:
Post a Comment