How to call google search APIs in batches?

Source: Internet
Author: User
1. If you need such a batch of keywords, you must call the google search API to find the desired link. {Code ...} for example, if a single data entry is 0 & amp; gt; string & #039; Yilan Ramen (Shibuya store) & #039; the returned result after google search API is called: {code ...} the API address for this call is also found in SF... 1. requirement

For such a batch of keywords, you need to call the google search API to find the desired link.

Array (size = 380) 0 => array (size = 3) 0 => string 'lan Ramen (Shibuya store) '(length = 23) 1 => string 'ichira' (length = 7) 2 => string ''(length = 0) 1 => array (size = 3) 0 => string 'akaka Eel (Shinjuku koshimayu store) '(length = 36) 1 => string 'akita koshimayu taobao' (length = 19) 2 => string ''(length = 0) 2 => array (size = 3) 0 => string 'Big & sushi '(length = 12) 1 => string 'daiwasushi' (length = 10) 2 => string ''(length = 0) 3 => array (size = 3) 0 => string 'izu Rong store '(length = 16) 1 => string ''(length = 0) 2 => string'' (length = 0) 4 => array (size = 3) 0 => string 'second (Shibuya store) '(length = 25) 1 => string 'fujiya' (length = 6) 2 => string ''(length = 0) 5 => array (size = 3) 0 => string 'noodle shop Musashi Shinjuku store' (length = 22) 1 => string 'menya musashi '(length = 13) 2 => string ''(length = 0 )...

For example, a single piece of data0 => string 'lan Ramen (Shibuya store )'Results returned after the google search API is called:

array (size=3)  0 => string 'http://tabelog.com/tw/tokyo/A1303/A130301/13166058/' (length=51)  1 => string 'http://tabelog.com/tokyo/A1303/A130301/13001762/' (length=48)  2 => string 'http://tabelog.com/cn/tokyo/A1303/A130301/13166058/dtlrvwlst/7326286/' (length=69)

The API address for this call isSFAddress:

http://ajax.googleapis.com/ajax/services/search/web?q=site:tabelog.com:%20Gucci%E5%92%96%E5%95%A1%20&v=1.0&start=0&rsz=3

Here?q=The following are the keywords to be queried,&start=Start from 0,&rsz=The size of the returned result is 3 data records.

2. Existing Problems

1) if you use the code to query only one keyword, the result will be returned normally. However, for batch execution, only 3% is returned, that is, only 3 of the 100 data records are returned.
2) if some keywords cannot return results, change the next keyword (in the same Array) until the result is searched.

3. Implementation

I used PHP cURL to call googleAPI to search for the desired URL.

4. Questions

1) Is there any way to implement batch call so that data (380 records) can return results normally (correct posture )?

Reply content: 1. Requirement

For such a batch of keywords, you need to call the google search API to find the desired link.

Array (size = 380) 0 => array (size = 3) 0 => string 'lan Ramen (Shibuya store) '(length = 23) 1 => string 'ichira' (length = 7) 2 => string ''(length = 0) 1 => array (size = 3) 0 => string 'akaka Eel (Shinjuku koshimayu store) '(length = 36) 1 => string 'akita koshimayu taobao' (length = 19) 2 => string ''(length = 0) 2 => array (size = 3) 0 => string 'Big & sushi '(length = 12) 1 => string 'daiwasushi' (length = 10) 2 => string ''(length = 0) 3 => array (size = 3) 0 => string 'izu Rong store '(length = 16) 1 => string ''(length = 0) 2 => string'' (length = 0) 4 => array (size = 3) 0 => string 'second (Shibuya store) '(length = 25) 1 => string 'fujiya' (length = 6) 2 => string ''(length = 0) 5 => array (size = 3) 0 => string 'noodle shop Musashi Shinjuku store' (length = 22) 1 => string 'menya musashi '(length = 13) 2 => string ''(length = 0 )...

For example, a single piece of data0 => string 'lan Ramen (Shibuya store )'Results returned after the google search API is called:

array (size=3)  0 => string 'http://tabelog.com/tw/tokyo/A1303/A130301/13166058/' (length=51)  1 => string 'http://tabelog.com/tokyo/A1303/A130301/13001762/' (length=48)  2 => string 'http://tabelog.com/cn/tokyo/A1303/A130301/13166058/dtlrvwlst/7326286/' (length=69)

The API address for this call isSFAddress:

http://ajax.googleapis.com/ajax/services/search/web?q=site:tabelog.com:%20Gucci%E5%92%96%E5%95%A1%20&v=1.0&start=0&rsz=3

Here?q=The following are the keywords to be queried,&start=Start from 0,&rsz=The size of the returned result is 3 data records.

2. Existing Problems

1) if you use the code to query only one keyword, the result will be returned normally. However, for batch execution, only 3% is returned, that is, only 3 of the 100 data records are returned.
2) if some keywords cannot return results, change the next keyword (in the same Array) until the result is searched.

3. Implementation

I used PHP cURL to call googleAPI to search for the desired URL.

4. Questions

1) Is there any way to implement batch call so that data (380 records) can return results normally (correct posture )?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.