Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 2 Support (Qt 5) › Unable to get ANY sort of http data

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #21526

    Ginzo Milani
            var request = HttpRequest
              .get(serverUrl)
              .then(function(res) {
                  console.log("11111111111");
                jsonData = res.body || jsonData // keep JSON result
                console.log(JSON.stringify(jsonData));
              })
              .catch(function(err) {
                  console.log("FFFFFFFFF");
                console.log(err.message)
                console.log(err.response)
    
              });
                console.log("RRRRRRRRRRRRR");
                 var xhr = new XMLHttpRequest
                 xhr.onreadystatechange = function() {
                   if (xhr.readyState === XMLHttpRequest.DONE) {
                     var dataString = xhr.responseText
                       console.log("888888888");
                       console.log(dataString);
                       console.log(JSON.stringify(xhr.getAllResponseHeaders()));
                       console.log("888888888");
                       //jsonData = JSON.parse(dataString)
                   }
                 }
                 console.log("EEEEEEEEEEEEE");
                 xhr.open("GET", serverUrl)
                 xhr.send()

    With httpRequest I get

    Error creating SSL context ()

    On PC, Windows 10. On Android Mobile the program does not work thus, I assume it’s exhibiting the same problems.

    With XMLHttpRequest I am just getting an empty response, no headers and no body. I tried https://jsonplaceholder.typicode.com/posts and even a simple .json hosted on a webserver https://tonberry.news/json/News.json

     

    Both are mostly copy pastes of the original code posted on the documentation so I don’t know why I am struggling so hard to get this engine to cooperate with me.

    Thus to no avail. I have literally EVERY thing the Maintenance Tool has to offer installed

    #21535

    Günther
    Felgo Team

    Hi,

    For Windows, you might require to install OpenSSL in order to make SSL requests. Can you try to install OpenSSL?

     

    For Android:
    Open up the Felgo Live app on your Android, then go to the web-editor, and connect it by entering your device id.

    Please then run this demo code:

    import Felgo 3.0
    
    App {
      Page {
        
          AppButton {
            anchors.centerIn: parent
            text: "Send Request"
            onClicked: {
          
                 // create request
                 HttpRequest.get("https://jsonplaceholder.typicode.com/posts")
                 .then(function(res) {
                   // The responseText looks like this {"ip":"xxx.xxx.xxx.xxx"}
                   // it automatically gets parsed into a JSON object
                   var responseJSON = res.body
                   // Read the ip property of the response
                   nativeUtils.displayMessageBox("Success", JSON.stringify(responseJSON))
                 })
                 .catch(function(err) {
                   nativeUtils.displayMessageBox("Error", err.message);
                 });
            
            }
          }
      }
    }
    

    You can verify whether SSL requests work on your mobile then.

    Best,
    Günther from Felgo

    #21575

    Ginzo Milani
    #21599

    Günther
    Felgo Team

    Hi,

    can you make sure that you have the following 2 libraries in your windows system folder (system32):

    libeay32.dll
    ssleay32.dll

    or place them in the same folder as your executable (build directory)? You should find them in the \bin folder of your OpenSSL directory.

    Best,
    Günther

Viewing 4 posts - 1 through 4 (of 4 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded