Please, if you don't care for Cookie - just DO use urlread!!! I DO mean it!
The only working way was to use Ice(Java) functions in Matlab, which are NOT documented in any way. Therefore one needs to experiment a lot with them!
So if you are not scared yet, here we go:
To read binary data use:
uint8( DataInputStream.read() )
To get cookie use:
CookieString = char(HttpURLConnection.getCookieManager().elements.nextElement.Cookie.toString)
or the following might also work
CookieString = char(HttpURLConnection.getCookieManager().getHeaderField('Set-Cookie') )
To set cookie use:
HttpURLConnection.setRequestProperty('Cookie', CookieString )
Since i am by no means an expert neither in Java nor in Matlab i might have overlooked something. Please do let me know if you know a better way.
ps: of course you start as follows:
URL = java.net.URL('http://example.url');
HttpURLConnection = URL.openConnection();