Hi Friends,
I have a requirement of getting the sponsored links from
the Google search page. I tried it using a URL class, I could get the
whole page, but my requirement is to get the URLs of all the Sponsored
Links in the Google Page . I am posting my code here,
import java.net.*;
import java.io.*;
public class Parsing
{
public static void main(String args[]) throws Exception
{
String line = null;
StringBuffer sb1=new StringBuffer();
BufferedReader buffer;
URL url = new URL("http://www.google.com/search?hl=en&q=adwords&meta= ");
URLConnection myConn = (HttpURLConnection)url.openConnection();
myConn.setRequestProperty("User-agent","");
buffer = new BufferedReader(new InputStreamReader(myConn.getInputStream
()));
while ((line = buffer.readLine()) != null) {
sb1.append(line);
}
System.out.println(sb1);
}
}
Please help me by suggesting the necessary changes that are needed to done
in the coding to get my requirement.
I apologize for my poor English
Thanks in advance
Regards,
Bindu.