Multiple file types search using Google Custom Sea

2019-07-28 22:45发布

I need to get Google search results for particular filetypes. For example, in browser I would directly google search for "hyperloop filetype:pdf" and it will list out PDF files for "Hyperloop". For this, my Google Custom Search request URI will be https://www.googleapis.com/customsearch/v1?key=MY_KEY&cx=MY_UNIQUE_ID&q=hyperloop&fileType=pdf

However, currently I would like to get search results for "hyperloop" of filetypes .ppt or .doc. In browser, I would achieve this by googling "hyperloop filetype:ppt OR filetype:doc".

What will be my Search request URI equivalent for this query? I could not find anything related to querying using multiple values for a single parameter in Google Custom Search Documentation.

2条回答
叼着烟拽天下
2楼-- · 2019-07-28 23:28

Rather than doing

q=hyerloop&filetype=pdf

you can use

q=hyperloop%20filetype:pdf%20OR%20filetype:doc
查看更多
混吃等死
3楼-- · 2019-07-28 23:36

use this its work

  $url='https://www.googleapis.com/customsearch/v1?key=AIzaSyCJUGIb_tevRKD-Kxxi5f4&cx=010407088:onjj7gscy2g&q='.  urlencode($keywords).'&filetype=doc&filetype=docx';

for me

查看更多
登录 后发表回答