0
I’m trying to collect the information contained in "Definition," but I’m having trouble accessing it. (It’s my first time working with API and PHP)
{
"tags": [
"hi",
"hi",
"hey",
"hey",
"greeting",
"greeting",
"yo",
"yo",
"goodbye",
"goodbye"
],
"result_type": "exact",
"list": [
{
"definition": "what you say when your talking casually with friends and your mom walks in the room",
"permalink": "http://hello.urbanup.com/69266",
"thumbs_up": 3528,
"author": "mad at the world",
"word": "hello",
"defid": 69266,
"current_vote": "",
"example": "What the hell(mom enters)-o mom.",
"thumbs_down": 975
},
{
"definition": "The only word on this site that has nothing to do with [sex] or [drugs]!",
"permalink": "http://hello.urbanup.com/2269237",
"thumbs_up": 2123,
"author": "pirates"
}
]
}
$json = file_get_html('http://api.urbandictionary.com/v0/define?term=hello')->plaintext;
$json = json_decode($json);
echo $json['definition']
?>
Could you be more specific? What’s going on?
– GustavoAdolfo
I’m using the urbandictionary api to collect word/expression definitions, and then I went from string to json, only I’m not able to manipulate the array to return the definition
– Matheus Silva
is being returned in json? used json_decode?
– twsouza
yes, as it is in the code
– Matheus Silva