You are here

function validateBynderDrupalUrl in Bynder 7

1 call to validateBynderDrupalUrl()
customResolutionUrl in includes/bynder.utils.inc

File

includes/bynder.utils.inc, line 157
utility functions for the bynder module

Code

function validateBynderDrupalUrl($url) {
  try {
    $reqHeaders = BynderMediaApi::getBynderApi()
      ->genericRequest($url);
    if ($reqHeaders
      ->getStatusCode() == '302' && isValid('bynder_drupal_url', reset($reqHeaders
      ->getHeaders()['Location']))) {
      return $url;
    }
    elseif ($reqHeaders
      ->getStatusCode() == '202') {
      return 'pending';
    }
  } catch (Exception $e) {
    watchdog('bynder', $e
      ->getMessage());
  }
  return false;
}