I’m trying to consumer this API from PHP. But I’m getting error/issues on both method - unirest and direct PHP Curl.
Note: I have the testing and productions keys!
My php code below: -
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, result = curl_exec(ch);
print_r($result);
What’s going wrong?
Please copy paste a working PHP code!
Join in the discussion - add comment below:
close it
Sorry for late response, it seems the application key error, if you have the testing key, pls ask mashape platform support.