Using CURL with Google

前端 未结 5 1362
温柔的废话
温柔的废话 2021-01-07 07:04

I want to CURL to Google to see how many results it returns for a certain search.

I\'ve tried this:

  $url = \"http://www.google.com/search?q=\".$str         


        
5条回答
  •  一向
    一向 (楼主)
    2021-01-07 07:34

    Use a GET request instead of a POST request. That is, get rid of

    curl_setopt($ch, CURLOPT_POST, true);
    

    Or even better, use their well defined search API instead of screen-scraping.

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题