Unirest 请求 - 错误 "Invalid API"

Unirest request - Error "Invalid API"

我是 curl 和请求内容的新手,目前我正在尝试使用 Unirest 请求从站点获取一些内容,但我遇到了问题。 (如果重要的话,我正在使用 cakePHP 2.9.5)

这是我的请求:

public function getsuggestions($word, $someData) {
        if(!empty($word) && $word != '') {
            $data = $this->find('all', array(
                'conditions' => array('Keyword.mot_saisi' => $word)
            ));
            if(!empty($data)) {
                $motcles = split(",",$data['0']['Keyword']['resultat'],11);
                $motcles['10'] = $word;
                return $motcles;
            }
            else { //We don't have the word in DB yet

                $country = $someData['Site']['pays'];
                $language = $someData['Site']['langue'];
                $url = 'https://ciokan-keyword-suggestion-v1.p.mashape.com/api/keyword/suggest/';
                $key = 'AKey'; //Can't share this
                require_once 'vendors\autoload.php';
                require_once 'vendors\mashape\unirest-php\src\Unirest.php';
                Unirest\Request::verifyPeer(false);
                $content = Unirest\Request::post($url,
                    array(
                        "X-Mashape-Key" => $key,
                        "Content-Type" => "application/x-www-form-urlencoded",
                        "Accept" => "application/json"
                    ),
                    array(
                        "country"   => $country,
                        "keyword"   => $word,
                        "language"  => $language,
                        "source"    => "google"
                    )
                );
                if(!empty($content)) {
                    debug($content); //Here is what is showing me an error
                    $decoded = json_decode($content,true);
                    debug($decoded);
                    $listWords = $decoded['results']['0'];
                    for ($i=1; $i < $decoded['total']['0']; $i++) { 
                        $listWords = $listWords.','.$decoded['results'][$i];
                    }
                    //Adding the answer in the DB
                    $data = array(
                        'id' => '',
                        'mot_saisi' => $word,
                        'resultat' => $listWords
                    );
                    if($this->save($data)) {
                        echo "Saved successfully";
                        $listWordsSplitted = split(",",$listWords,11);
                        $listWordsSplitted['10'] = $word;
                        return $listWordsSplitted;
                    }
                    else {
                        echo "Saving failed";
                    }
                }
            }
            //curl_close($ch);
        }
    }

这是我在浏览器中显示 $content 时遇到的错误, 接收 Unirest 请求答案的变量:

object(Unirest\Response) {
    code => (int) 403
    raw_body => '{"message":"Invalid API"}'
    body => object(stdClass) {
        message => 'Invalid API'
    }
    headers => array(
        (int) 0 => 'HTTP/1.1 403 Forbidden',
        'Content-Type' => 'application/json',
        'Date' => 'Tue, 22 May 2018 06:58:21 GMT',
        'Server' => 'Mashape/5.0.6',
        'X-Mashape-Proxy-Response' => 'true',
        'Content-Length' => '25',
        'Connection' => 'keep-alive'
    )
}

我在任何地方都找不到具体的答案。 这是什么意思 ?有办法解决这个问题吗?

找到原因, 只是因为我想从获取信息的站点删除了他的API.

不需要更多答案:)