2016-07-13 41 views
0

我收到錯誤無效的關鍵錯誤無效-API密鑰鍊金術API文本PHP /捲曲/ TextGetCombinedData

捲曲/ 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); 

請讓我知道,如果我我錯過了什麼。

謝謝 巴斯卡爾

回答

0

我想你失蹤(在

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

謝謝瓊。很抱歉的錯字。我有一個括號/支架。還是同樣的問題 – bgara

+0

能否請您給所有的你的源代碼,所以我可以在我的本地測試 –

+0

這是我在WAMP服務器上運行的完整代碼。 – bgara