http AcceptTypes property
Return to Introduction  Previous page  Next page
Applies to
WinHTTP component.  

Declaration
property AcceptTypes: String// default is "*/*"  

Description

The AcceptTypes property specifies the array of media types (also known as Multipurpose Internet Mail Extension (MIME) type) which you would like to receive from the Web using the WinHTTP component (HTTP client). These strings indicates content types accepted by the client. If AcceptTypes is empty, no types are accepted by the client.  
 
iiinfo For example, if you would like to get HTML files only, set AcceptTypes property to "text/html". To receive flat-text files only, set AccessTypes to "text/plain".  
 
Servers interpret a lack of accept types to indicate that the client accepts only documents of type "text/*" (that is, only text documents, and not pictures or other binary files.  
 
To specify multiple MIME types, sepearate them by comma sign "," (ie: "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, */*").  
 
tip Some servers always checking the media types accepted by client to determinate the data format prefered by client. For example, lately some servers can returns human readable data both in HTML and WML formats. HTML used for output to standard Web-browsers and WML for output to celluar phones, handheld computers and other WAP devices. To determinate the client type, server uses the HTTP_ACCEPT environment of client:  
if ($ENV{'HTTP_ACCEPT'} =~ /wml/) {  
  print "Location: http://website.com/wap/index.wml\n\n";  
}else {  
  print "Location: http://website.com/index.html\n\n";  
When server founds "WML" word between the accepted types, it will redirect the client to certain WAP page. As you can see, sometimes the HTTP output depend on accepted media types.  
 
For more details on Accept header please see the reference at http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1  

Remark
iiwarning Some servers does not check accepting types at all and can return files with ANY media type.  

See also
AddHeaders, Agent, URL and Referer properties.