Reputation:
public function index($word)
{
$response = Http::withHeaders([
'app_id' => 'xxxxxxx',
'app_key' => 'xxxxxxxxxxxxxxxx'
])->get('https://od-api.oxforddictionaries.com/api/v2/lemmas/en/{word_id}')->json();
return $response
}
How can I send the variable $word in the {word_id}
in this function
I Have Tried
(https://od-api.oxforddictionaries.com/api/v2/lemmas/en/{word_id}',['word_id'=>$word]);
GOt error
Upvotes: 0
Views: 215
Reputation: 587
You can concat it like this get('https://od-api.oxforddictionaries.com/api/v2/lemmas/en/'.$word)
or you can use double quotes like this get("https://od-api.oxforddictionaries.com/api/v2/lemmas/en/$word")
Upvotes: 1