Click to See Complete Forum and Search --> : java URL


pfrank71
02-01-2005, 07:52 AM
Hi,

i would like to programm a little java applet which signs me into ebay automatically and gives me the option to run search querys.
I can start search queries without any problems by :
String URLquery = "http://www.ebay.com....";
URL url = new URL(URLquery);
InputStream in = url.openStream();
while ( in.read(b) != -1) {
htmlSource = htmlSource + new String(b);
}

But now i have got the problem that when i want to search for completed auctions i have to sign in.
Now here is my question: Is it possible for me to sign into ebay through an url query from java.
What about cookies. The Sign In info is usually stored in a cookie. So how can i catch/save/use the cookie..

thanks a lot

peter

Khalid Ali
02-01-2005, 02:22 PM
eBay has a developer program and they provide you with a Java API, these API
's let you do most of the tasks which you could do using a web browser.

ray326
02-01-2005, 04:56 PM
I think you'll find what you need in the HttpURLConnection class. Another user here sort of introduced it to me and it is really a powerful tool.

Khalid Ali
02-01-2005, 06:58 PM
Originally posted by ray326
..find what you need in the HttpURLConnection class.

if he/she is to use any of the Java classes that means he will have to get the response and parse it, then find in that stream what he/she is looking for and display the required html.
The biggest problem will come if the eBay people chagne their layout in the HTML, which means now he/she will have to re-write the code again to check for certain flags to retrieve required data from the response. This approach may work in some static sites where they do not have any udates in years, for dynamic website like eBay a proper solution should be looked for. Which luckily eBay provides you as a complete API to almost all of the tasks using Java as you can do using webpages and its legal aswell...Hope this clears difference;)

ray326
02-01-2005, 11:11 PM
OIC ;)