php guzzle issue with requestAsync call to wordsAPI
Get the solution ↓↓↓did anyone have an issue related to php guzzle and simple request call to wordsAPI?
I'm currently developing on my localhost using XAMPP. This is what I intend to do:
use GuzzleHttp\Client;
use Psr\Http\Message\ResponseInterface;
use GuzzleHttp\Exception\RequestException;
$client = new Client();
$promise = $client->requestAsync('GET', 'https://wordsapiv1.p.mashape.com/words/example', [
"headers" => [
"x-rapidapi-host" => "wordsapiv1.p.rapidapi.com",
"x-rapidapi-key" => apikey
]
]);
$promise->then(
function (ResponseInterface $res) {
echo $res->getStatusCode() . "\n";
},
function (RequestException $e) {
echo $e->getMessage() . "\n";
echo $e->getRequest()->getMethod();
}
);
$promise->wait();
However, it fails miserably with the following error:
Fatal error: Uncaught GuzzleHttp\Exception\ConnectException: cURL error 6: Could not resolve host: wordsapiv1.p.mashape.com (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)
Any thoughts?
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: the metadata storage is not up to date, please run the sync-metadata-storage command to fix this issue.
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.