Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Original thread:
Post 36 made on Thursday August 6, 2020 at 17:44
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,554
Try this:

function kodi2(){
receivedData = "";
socket.onConnect = function() {
write("GET /t/p/original/"+cover+".jpg HTTP/1.0\r\n");
write("HOST: image.tmdb.org\r\n");
write("CONNECTION: close\r\n");
write("\r\n");

};
socket.onData = function() {
receivedData += read();
};
socket.onIOError = function (e) {
widget("output").label = "IOError " + e;
};
socket.onClose = function () {
var imageStartIndex, bitmapData, myImage;
// remove the HTTP header from the received data
imageStartIndex = receivedData.indexOf("\r\n\r\n");
bitmapData = receivedData.substring(imageStartIndex+4);
// make and display the image
myImage = new Image(bitmapData);
widget("MOVIE_COVER").setImage(myImage);
};
socket.connect(image.tmdb.org,80,3000);
scheduleAfter(500,kodi3);
};


Some websites require that the 'Host' HTTP Request header be present.

If you are hitting a site that uses the HTTP 1.1 protocol, it is also good to specify the 'Connection' request header.

If you are interested in learning more about the HTTP protocol, I would recommend not looking at the HTTP RFCs but rather a book by O'Reilly called "Webmaster In A Nutshell".

Last edited by Lyndel McGee on August 6, 2020 17:59.
Lyndel McGee
Philips Pronto Addict/Beta Tester


Hosting Services by ipHouse