如何使用PHP读取JSON数据响应?阅读JSON数据带有PHP令牌
这是代码:
$response = Unirest\Request::get("https://montanaflynn-spellcheck.p.mashape.com/check/?text=This+sentnce+has+some+probblems.",
array(
"X-Mashape-Key" => "MY X-Mashape-Key",
"Accept" => "application/json"
)
);
,并给我这个JSON数据:
{
"original": "This sentnce has some probblems.",
"suggestion": "This sentence has some problems.",
and ...
}
我想在URL返回 “suggestion
” 与$
这是一个例子:
$user_id = '123456789'
$mytext = '?' // I WANT RETURN "suggestion" HERE !
$url = 'https://api.telegram.org/mytoken/sendMessage?chat_id='.$user_id.'&text='.$mytext
file_get_contents($url);
给我们输入和预期输出的一个例子。 – Dimi