public function getRedirectLocation($url, $query = [])
    {
        $url = $this->buildUrl($url, $query);

        $request = $this->requestFactory->createRequest('GET', $url);

        try {
            $response = $this->request($request);
        } catch (ResourceNotFound $e) {
            return;
        }

        $locations = $response->getHeader('Location');

        return count($locations) ? $locations[0] : null;
    }
public function getRedirectLocation($url, $query = [])
    {
        $url = $this->buildUrl($url, $query);

        $request = $this->requestFactory->createRequest('GET', $url);

        try {
            $response = $this->request($request);
        } catch (ResourceNotFound $e) {
            return;
        }

        $locations = $response->getHeader('Location');

        return count($locations) ? $locations[0] : null;
    }
public function getRedirectLocation ( $ url , $ query = [ ] ) { $ url = $ this -> buildUrl ( $ url , $ query ) ; $ request = $ this -> requestFactory -> createRequest ( 'GET' , $ url ) ; try { $ response = $ this -> request ( $ request ) ; } catch ( ResourceNotFound $ e ) { return ; } $ locations = $ response -> getHeader ( 'Location' ) ; return count ( $ locations ) ? $ locations [ 0 ] : null ; }
Get the redirect target location of an URL, or null if not a redirect.

@param string $url
@param array  $query

@return string|null
Get the redirect target location of an URL or null if not a redirect .