Document Similarity

FREEMIUM
By TextMiner | Updated 4日前 | Data
Health Check

N/A

Back to All Discussions

API not working. Both Unirest & PHP.

Rapid account: Vibhanshu
vibhanshu
8年前

I’m trying to consumer this API from PHP. But I’m getting error/issues on both method - unirest and direct PHP Curl.

  1. Unirest - I get a 400 error.
  2. Direct PHP Code - The API seems to work but as a response I get {“message”:“Missing Mashape application key. Go to http://docs.mashape.com/api-keys to learn how to get your API application key.”}

Note: I have the testing and productions keys!

My php code below: -

ch=curlinit();ch = curl_init(); curlConfig = array(
CURLOPT_URL => “https://textanalysis-document-similarity-v1.p.mashape.com/document-similarity”,
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array(
‘Accept’ => ‘application/json’,
‘X-Mashape-Key’ => ‘secret-key’,
‘Content-Type’ => ‘application/x-www-form-urlencoded’
),
CURLOPT_POSTFIELDS => array(
‘text1’ => ‘Deep learning is a set of algorithms in machine learning that attempt to model high-level abstractions in data by using model architectures composed of multiple non-linear transformations.’,
‘text2’ => ‘Machine learning is a scientific discipline that explores the construction and study of algorithms that can learn from data.’
)
);
curl_setopt_array($ch, curlConfig);curlConfig); result = curl_exec(ch);curlclose(ch); curl_close(ch);
print_r($result);

What’s going wrong?
Please copy paste a working PHP code!

Rapid account: Textanalysis
textanalysis Commented 8年前

close it

Rapid account: Textanalysis
textanalysis Commented 8年前

Sorry for late response, it seems the application key error, if you have the testing key, pls ask mashape platform support.

Join in the discussion - add comment below:

Login / Signup to post new comments