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;
	}
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;
	}
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 ; }
Get HTTP request response header string

@param string $url target URL
@return string
@author Naoki Sawada
Get HTTP request response header string