I send a POST message to the server:
ih = InternetPostRequest( url, post_text,
INTERNET_FLAG_TRANSFER_ASCII
|INTERNET_FLAG_KEEP_CONNECTION
);
if( ih )
{
while( ( resp = InternetReadString( ih ) ) != "" )
{
_TRACE( "Response: " + resp );
}
_TRACE( "Status code : " + InternetGetStatusCode( ih ) );
InternetClose( ih );
}
else
{
printf( "Internet connection can not be open because: %s", GetLastOSError() );
}
Is it possible to read the server response when an error occurs, e.g. 406? It seems to me that InternetReadString reads the "Response" only when the status is 200. I would also like to get the HTTP error code.