0

I am getting ERROR Invalid key

cURL/php CODE:

 $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);

Please let me know if I am missing something.

Thank you Bhaskar

bgara
  • 143
  • 1
  • 12

1 Answers1

0

I think you missing ( at

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