Reputation: 443
I'm trying to get a specific link for each of my videos from the Vimeo API. I can loop through the results and echo them in a foreach but when I try to access a specific value it still out puts all the results:
// Make Request
$response = $lib->request('/videos/'.$vurl.'?fields=files', [ ], 'GET');
// Get Response
$links = $response['body']['files'];
foreach ($links as $key => $value) {
if ($value['width'] = '1920') {
echo $value['link_secure'];
} else {
echo 'no match';
}
}
How do I access just the result where the $value equals '1920'?
Upvotes: 0
Views: 73
Reputation: 633
use == instead of = here.
if ($value['width'] == 1920) {
echo $value['link_secure'];
} else {
echo 'no match';
}
Upvotes: 2