我希望php脚本能够使用Unirest php获取json
<?php
require_once 'src/Unirest.php';
$word = 'Cartoon newttork';
// return: convert-spaces-to-underscore-and-lowercase-with-php
$word = str_replace(' ', '_', strtolower($word));
// These code snippets use an open-source library.
$response = Unirest\Request::get("https://od-api.oxforddictionaries.com:443/api/v1/entries/en/$word",
array(
"Accept" => "application/json", // accept app as json
"app_id" => "xxxxx", // app id found in dashboard
"app_key" => "xxxxxx" //app key also found in dashboard
)
);
$word_name = $response->body;
if ($word_name === "Not Found") {
echo "Not Found";
}
?>
我希望是这样的
$word_name = $response->body;
if ($word_name === "Not Found") {
echo "Not Found";
}
如果你有另一个php http客户端,那么最好把它写下来