Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

How do you connect to a HTTPS url?

$
0
0

App.js

(function() {
 
    var myView = Ti.UI.createView();
    var win = Ti.UI.createWindow();
    var label = Ti.UI.createLabel();
 
    myView.add(label);
    win.add(myView);
    win.open();
 
    var xhr = Ti.Network.createHTTPClient({
        onload : function() {
            Ti.API.info("Successfully received data from HTTPS");
            label.text = this.responseText;
        },
        onerror : function() {
            Ti.API.info("There was an error receiving data from HTTPS.");
        }
    });
    xhr.open("GET", "https://www.muthwill-it.se/other/titanium/1.txt");
    xhr.send();
 
})();
Gives me: [INFO] : There was an error receiving data from HTTPS.

I've been searching for ages to an answer to this question that I'm sure many people have. Is there a simple guide to enable HTTPS in an HTTPClient? There's nothing wrong with the url either, here's the link: Muthwll-IT JSON Example - Using HTTPS

I've seen somewhere that you need to download and validate the certificate, but how on Earth do you do that?

Thank you very much for your help!


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>