Use REST Module to send HEAD request and return the response.

@since 0.2.0

@param string $url

@return null|Response
341316
protected function sendHeadAndGetResponse($url)
    {
        /** @var REST $rest */
        $rest = $this->getModule('REST');
        $rest->sendHEAD($url);

        return $rest->client->getInternalResponse();
    }
549716
public function post(string $url, $params = null): HttpResponse
    {
        return $this->send('POST', $url, [
            $this->bodyFormat => $params,
        ]);
    }
988540
static public function rUrl($url)
    {
        $module = null;
        if (strpos($url, 'http') !== 0 && ($pos = strpos($url, ':')) !== false) {    // 1. "x:a/b" module or xUrl
            $module = trim(substr($url, 0, $pos), '/');
            $url   = trim(substr($url, $pos + 1), '/');
        }
        
        if (strpos($url, 'http') === 0) {
            $url = str_replace(static::url($module . ':'), '', $url);
        }
        
        return trim($url, '/');
    }
290236
public function get(string $url, array $headers = [])
    {
        $ctx = $this->getContext('GET', null, $headers);
        $response = file_get_contents($url, false, $ctx);
        $this->saveCookies($http_response_header);

        return $response;
    }
1169190
private function getHttpResponseHeader($url) {
		if (function_exists('curl_exec')) {

			$c = curl_init();
			curl_setopt( $c, CURLOPT_RETURNTRANSFER, true );
			curl_setopt( $c, CURLOPT_CUSTOMREQUEST, 'HEAD' );
			curl_setopt( $c, CURLOPT_HEADER, 1 );
			curl_setopt( $c, CURLOPT_NOBODY, true );
			curl_setopt( $c, CURLOPT_URL, $url );
			$res = curl_exec( $c );
			
		} else {
			
			require_once 'HTTP/Request2.php';
			try {
				$request2 = new HTTP_Request2();
				$request2->setConfig(array(
                    'ssl_verify_peer' => false,
                    'ssl_verify_host' => false
                ));
				$request2->setUrl($url);
				$request2->setMethod(HTTP_Request2::METHOD_HEAD);
				$result = $request2->send();
				$res = array();
				$res[] = 'HTTP/'.$result->getVersion().' '.$result->getStatus().' '.$result->getReasonPhrase();
				foreach($result->getHeader() as $key => $val) {
					$res[] = $key . ': ' . $val;
				}
				$res = join("\r\n", $res);
			} catch( HTTP_Request2_Exception $e ){
				$res = '';
			} catch (Exception $e){
				$res = '';
			}
		
		}
		return $res;
	}
712807
public function getDummyRequest($url = null) {
        if ($url === null) {
            $url = $this->getDummyUrl();
        }
        $request = Mage::getModel('turpentine/dummy_request', $url);
        $request->fakeRouterDispatch();
        return $request;
    }
1269459
public function httpGetRequest($url)
    {
        // create curl resource
        $curl = curl_init();

        // set url
        curl_setopt($curl, CURLOPT_URL, $url);

        //return the transfer as a string
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

        // $output contains the output string
        $response = curl_exec($curl);

        $resolve = $this->curlResponse->resolve($curl, $response);

        curl_close($curl);

        return $resolve;
    }
355260
private function request($url)
    {
        $url = $this->makeRequestUrl($url);

        try {
            $cliMulti  = $this->makeCliMulti();
            $responses = $cliMulti->request(array($url));

            $response  = !empty($responses) ? array_shift($responses) : null;
        } catch (Exception $e) {
            return $this->logNetworkError($url, $e->getMessage());
        }
        if ($this->checkResponse($response, $url)) {
            return $response;
        }
        return false;
    }
625738
function send($url) {
             
            // Get xml document
            $strXML = $this->toString();
             
            // Get url parts
            if (!preg_match("/http/", $url)) $url = "http://".$url;
            $urlParts = parse_url($url);
            $host = isset($urlParts['host'])?$urlParts['host']:
            'localhost';
            $port = isset($urlParts['port'])?$urlParts['port']:
            80;
            $path = isset($urlParts['path'])?$urlParts['path']:"/";
             
            // Open a connection with the required host
            $fp = fsockopen($host, $port, $errno, $errstr);
            if (!$fp) {
                $this->status = -11;
                $this->error = "Unable to connect to $host at port $port: ($errno) $errstr";
                return false;
            }
             
            // Send the xml document
            fputs($fp, "POST ".$path." HTTP/1.0\r\n". "Host: ".$host."\r\n". "Content-length: ".strlen($strXML)."\r\n". "Content-type: ".$this->contentType."\r\n". "Connection: close\r\n\r\n". $strXML."\r\n");
             
            return $fp;
             
        }
890474
public static function get(string $url)
	{
		$ch = curl_init($url);

		curl_setopt_array(
			$ch,
			[
				CURLOPT_HEADER         => 1,
				CURLOPT_RETURNTRANSFER => 1,
				CURLOPT_SSL_VERIFYPEER => 0,
			]
		);

		$response = curl_exec($ch);

		$responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
		if ($responseCode != 200) {
			throw new HttpException('Could not reach ' . $url, $responseCode);
		}
		$contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
		$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);

		curl_close($ch);

		$response = substr($response, $headerSize);

		if (is_null($response)) {
			throw new HttpException('You are exceeding the API request limit.  Please wait longer between requests.', 400);
		}

		if(stripos($contentType, 'application/json') !== false) {
			$response = json_decode($response, true);
		}

		return $response;
	}
1105476
public RequestBuilder head(final String url) {

    checkNotNull(url, "url may not be null");
    final AsyncHttpClient.BoundRequestBuilder ningRequestBuilder = asyncHttpClient.prepareHead(url);
    return createNewRequestBuilder(url, ningRequestBuilder);
  }
1110978
private function &getHandle($url) {
      $http = curl_init();

      curl_setopt($http, CURLOPT_USERAGENT, Client::getUserAgent());
      curl_setopt($http, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($http, CURLOPT_URL, $url);

      return $http;
    }
1244209
private function getClusterHeader($url)
    {
        $cacheKey = 'project-cluster:' . $url;
        $cluster = $this->cache ? $this->cache->fetch($cacheKey) : false;
        if ($cluster === false) {
            $this->debug('Making a HEAD request to identify project from URL: ' . $url);
            try {
                $response = $this->api->getHttpClient()->head($url, [
                    'auth' => false,
                    'timeout' => 5,
                    'connect_timeout' => 5,
                    'allow_redirects' => false,
                ]);
            } catch (RequestException $e) {
                // We can use a failed response, if one exists.
                if ($e->getResponse()) {
                    $response = $e->getResponse();
                } else {
                    $this->debug($e->getMessage());

                    return false;
                }
            }
            $cluster = $response->getHeaderAsArray($this->config->get('service.header_prefix') . '-cluster');
            $canCache = !empty($cluster)
                || ($response->getStatusCode() >= 200 && $response->getStatusCode() < 300);
            if ($canCache) {
                $this->cache->save($cacheKey, $cluster, 86400);
            }
        }

        return is_array($cluster) ? reset($cluster) : false;
    }
808047
public function request($url)
    {
        $curlOpts = array_replace($this->curlOpts, [CURLOPT_URL => $url]);

        $ch = curl_init();
        foreach ($curlOpts as $opt => $optVal) {
            curl_setopt($ch, $opt, $optVal);
        }

        $resp = curl_exec($ch);
        $info = (object) curl_getinfo($ch);
        curl_close($ch);

        //Check response
        $httpCode = (string) $info->http_code;
        if ($httpCode{0} != '2') {
            $msg = sprintf('HTTP Request Failed (code %s): %s', $info->http_code, $resp);
            throw new HttpException($resp, $msg, $httpCode);
        } elseif (strlen(trim($resp)) == 0) {
            throw new HttpException($resp, 'HTTP Response Empty');
        }

        return $resp;
    }
30434
public function request($url)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
        curl_setopt($ch, CURLOPT_REFERER, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

        $result = curl_exec($ch);
        curl_close($ch);

        return json_decode($result);
    }
300628
protected function request($url)
	{
		$response = null;
		try {
			$response = $this->getHttpClient()
				->get($url)
				->send();
		} catch (ClientErrorResponseException $e) {
			return Json::encode([
				'error' => $e->getMessage()
			]);
		}

		return $response->json();
	}
392768
public function head($url, $options = [], $body = null)
    {
        return $this->httpRequest('HEAD', $this->createUrl($url, $options), $body);
    }