问题
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.
回答1:
Rather than doing
q=hyerloop&filetype=pdf
you can use
q=hyperloop%20filetype:pdf%20OR%20filetype:doc
回答2:
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
来源:https://stackoverflow.com/questions/18901738/multiple-file-types-search-using-google-custom-search-api