ERROR invalid-api-key PHP /CURL for Alchemy api text/TextGet


ERROR invalid-api-key PHP /CURL for Alchemy api text/TextGetCombinedData

我收到错误无效键

cURL/PHP 代码:

 $request = "https://gateway-a.watsonplatform.net/calls/url/URLGetAuthors?apikey=$alchemyapikey&url=www.ibm.com";
    //echo $request;
    $curl = curl_init($request);
   $alchemydata = array
      'apikey' => $alchemyapikey,
      'text' => strip_tags($result),
      'outputMode' => 'json',
      'extract'=>'entities,keywords',
      'url'=>'https://www.ibm.com/us-en/',
    );
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $alchemydata);
    curl_setopt($curl, CURLOPT_URL, "https://gateway-a.watsonplatform.net/calls/text/TextGetCombinedData");
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    $result = curl_exec($curl);
    if ($result === FALSE) {
        die("Curl failed: " . curL_error($curl));
    }
    curl_close($curl);

如果我错过了什么,请告诉我。

谢谢巴斯卡尔

我想你错过了( 在

$alchemydata = array(
    'apikey' => $alchemyapikey,
    'text' => strip_tags($result),
    'outputMode' => 'json',
    'extract'=>'entities,keywords',
    'url'=>'https://www.ibm.com/us-en/',
);