作者 李宇航

合并分支 'lyh-server' 到 'master'

gx



查看合并请求 !1778
@@ -33,7 +33,13 @@ class RapIdApIService @@ -33,7 +33,13 @@ class RapIdApIService
33 */ 33 */
34 public function requestUrl($keyword){ 34 public function requestUrl($keyword){
35 $this->url = 'https://google-keyword-insight1.p.rapidapi.com/globalkey'; 35 $this->url = 'https://google-keyword-insight1.p.rapidapi.com/globalkey';
36 - $url = $this->url.'/?keyword='.$keyword.'&lang=en'; 36 + $param = [
  37 + 'keyword'=>$keyword,
  38 + 'location'=>'US',
  39 + 'lang'=>'en'
  40 + ];
  41 + $query_string = str_replace('+', '%20', http_build_query($param));
  42 + $url = $this->url.'/?'.$query_string;
37 $data = $this->curlGoogleApi($url); 43 $data = $this->curlGoogleApi($url);
38 return $data; 44 return $data;
39 } 45 }
@@ -47,13 +53,7 @@ class RapIdApIService @@ -47,13 +53,7 @@ class RapIdApIService
47 */ 53 */
48 public function requestKeywordUrl($keyword){ 54 public function requestKeywordUrl($keyword){
49 $this->url = 'https://google-keyword-insight1.p.rapidapi.com/topkeys'; 55 $this->url = 'https://google-keyword-insight1.p.rapidapi.com/topkeys';
50 - $param = [  
51 - 'keyword'=>$keyword,  
52 - 'location'=>'US',  
53 - 'lang'=>'en'  
54 - ];  
55 - $query_string = http_build_query($param);  
56 - $url = $this->url.'/?'.$query_string; 56 + $url = $this->url.'/?keyword='.$keyword.'&location=US&&lang=en';
57 return $this->curlGoogleApi($url); 57 return $this->curlGoogleApi($url);
58 } 58 }
59 59