Passing more than one parameter

Hi,
Is there a way of passing more than one parameter in Screen-Scraper. At present I'm using Net Beans IDE to pass parameters to Screen Scraper server. Suppose the URL that I need to scrape looks something like this:

http://www.mysite.com/~#parameter1#~text~#parameter2#~/new.html

How do I pass two parameters from Net beans IDE for this URL.

Help!!

Passing more than one parameter

Hi,

Try putting this line:

RemoteScrapingSession remoteSession = new RemoteScrapingSession("NewScrape");

Inside your "while" loop.

Best,

Todd

Amazing Swift Response!

Hi Todd,

I really appreciate your swift response. I never expected you to reply so soon. I still don't understand. Can you help me out here. I've pasted the code below.

import java.util.*;

public class Ace3
{
/**
* The entry point.
*/
public static void main(String[] args)
{

try
{
// Create a remoteSession to communicate with the server.
RemoteScrapingSession remoteSession = new RemoteScrapingSession("NewScrape");

// Load parameters from a file
FileInputStream inFile = new FileInputStream("C:\\Sample.txt");

byte[] stream = new byte[inFile.available()];

int bytes = inFile.read(stream);
inFile.close();

String inputData = new String(stream);

//String inputData = "New York,New York";
StringTokenizer st = new StringTokenizer(inputData,",\n\r\f");

String zip;
int x = 1;
int y = st.countTokens();
System.out.println("This scrape will occur using " + y + " Zipcodes:");

while(st.hasMoreTokens())
{
zip = st.nextToken();

// Put the query in a session variable so we can reference it later.
// Note that we need to URL encode the query as it will be passed
// to the server in the query string of the URL.
// Begin the search results offset at 0 so that we start at the first page.
remoteSession.setVariable("ZIP_PARM",URLEncoder.encode(zip,"UTF-8"));
DateFormat shortTimestamp = DateFormat.getDateTimeInstance(DateFormat.SHORT,DateFormat.SHORT);
System.out.println("Running scrape " + x++ + " of " + y + ": " + zip + " on " + shortTimestamp.format(new Date()));

// Tell the scraping session to scrape.
remoteSession.scrape();
Thread.sleep(1000);
}
System.out.println(" Scraping Complete - Java");
// Scraper.
// Very important! Be sure to disconnect from the server.
remoteSession.disconnect();
}
catch(Exception e)
{
System.err.println(e.getMessage());
}
}
}

Passing more than one parameter

Hi,

It sounds like you're invoking screen-scraper remotely using Java. If that's the case, then you can simply call the setVariable method multiple times for each of the variables you'd like to set. If you haven't done so already, it would probably help for you to go through our second ([url]http://www.screen-scraper.com/support/tutorials/tutorial2/tutorial_overview.php[/url]) and fourth ([url]http://www.screen-scraper.com/support/tutorials/tutorial4/tutorial_overview.php[/url]) tutorials.

Kind regards,

Todd Wilson