I've used different methods and found it difficult to integrate mashape for a dictionary..

My code is below:

require_once 'unirest-php/src/Unirest.php';
// These code snippets use an open-source library.
$response = Unirest\Request::get("https://montanaflynn-dictionary.p.mashape.com/define?word=irony",
  array(
    "X-Mashape-Key" => "T2rwS1jyBSmshKoZB5Un2kfpvgtRp1hUS9pjsnHvPoGNHIMpda",
    "Accept" => "application/json"
  )
);

What am I not getting right

Regards

First, you shouldn't make your Mashape Key public
Secondly you are not doing anything with the $response variable.
Ideally you should process $response
For example try to add on line 9., empty line, var_dump($response);
You will see what the variable contains.

Best

I get the following error:

Fatal error: Uncaught exception 'Exception' with message ' in C:\wamp\www\81divmesselibrary\search\unirest-php\src\Unirest\Request.php on line 394

( ! ) Exception: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in C:\wamp\www\81divmesselibrary\search\unirest-php\src\Unirest\Request.php on line 394

This is not a Mashape's Unirest error, this is a problem with your server setup. I suggest looking into SSL issues on PHP to resolve the error. Again this is something at a deeper level than Unirest.

Ok. I will check that now.

I did just that and it worked. thanks so much for your help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.