1

Does anyone know if there's an easy way to implement this:

I have an array of strings (~650 elements) and would like to google each element, and then have the number of results acquired in each search stored in another integer array. I looked at the Google API, but it seems a little daunting to me, it seems like a fairly simple task, but can't seem to find any guidance on how to do this.

Help is much appreciated. Thanks.

1 Answer 1

2

My first thought was to do the following. I don't think its the fastest or most elegant way, but I think it should do the trick:

If you check a URL on Google, they all look the same:

http://www.google.com/search?q='here your searchword'

So i would just iterate over your array and for each string create a url like e.g.

http://www.google.com/search?q=test

do a HTTP-Post for that and parse the result.

Here is a short example of the HTTPPost. You can also see how to get the response. I don't know how googles response is looking, but if you just print out the whole response, I think you will see how you have to parse it.

Sign up to request clarification or add additional context in comments.

3 Comments

I was considering that, but I thought that would just involve a lot of copying and pasting. How would I go abbout a HTTP-Post/Parse? I was also joping for a more elegant way of just returning the number of results into each element of another array.
Thanks again. When I try to create a new URL, it tells me that URL cannot be resolved to a type, how/where i can I import this class?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.