Sitemap
Links
+++ erd.trabant +++

+++ erd.trabant +++

blablabla

blablabla

determine MIMEType, http requests

$FQDN="www.meinedomain.tld";

 function getMime($file,$host='',$port=80)  {
 global $FQDN;
 $host=$FQDN;
 $response = send_http_request("HEAD $file HTTP/1.0\r\nUser-Agent:
 PHP\r\n".
                                 "Host: $host:$port\r\n\r\n");
   if($response['header']['HTTP_STATUS_CODE'] == 200) {
       return $response['header']['HTTP_CONTENT-TYPE'];
   } else {
       return $response['header']['HTTP_STATUS_CODE'];
   }
 }

 function send_http_request($request='',$host='',$port=80)  {
 global $FQDN;
  $host=$FQDN;
    if(!$fp=fsockopen($host, $port))
     return 0;
   if (!fputs($fp, $request, strlen($request)))
     return 0;
   while(!feof($fp)) $data .= fread($fp, 256); //win32 limit 2048
     fclose($fp);
 
   $http_response = get_http_response($data);
   return $http_response;
 }
 
 function get_http_response($data)  {
   $pos = strpos($data,"\r\n\r\n");
   $data = array(substr($data,0,$pos),substr($data,$pos+4));
   $tmp = explode("\r\n", $data[0]);
   $response['content'] = $data[1];
   ereg("^(.*) ([[:digit:]]*) (.*)",$tmp[0],$http);
   $response['header']['HTTP_VERSION']       = $http[1];
   $response['header']['HTTP_STATUS_CODE']   = $http[2];
   $response['header']['HTTP_REASON_PHRASE'] = $http[3];
   for($i=1;$i<count($tmp);$i++)  {
     list($env,$value) = explode(':',$tmp[$i]);
     $response['header']["HTTP_".strtoupper($env)] = ltrim($value);
   }
   return $response;
 }

>>PopUP / Drucken / Print<<
blablabla