MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    http request

    Scheduled Pinned Locked Moved Development
    53 Posts 7 Posters 49.2k Views 6 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • KirAsh4K Offline
      KirAsh4 Moderator
      last edited by

      XMLHTTPRequest. Look at how the 'currentweather' module does it in the 'updateWeather()' function.

      A Life? Cool! Where can I download one of those from?

      1 Reply Last reply Reply Quote 0
      • E Offline
        Eunanibus Module Developer
        last edited by

        Yeah that’s what I based my original request functionality on. The OpenWeather API response is CORS compatible due to the response header - this is why the example response works well. Outside of this domain though (say on http://www.w3schools.com/xml/cd_catalog.xml (or any other external server). This unfortunately makes problems - I’m still looking for a work-around.

        1 Reply Last reply Reply Quote 0
        • KirAsh4K Offline
          KirAsh4 Moderator
          last edited by

          Welcome to Javascript security issues.

          A Life? Cool! Where can I download one of those from?

          A 1 Reply Last reply Reply Quote 0
          • A Offline
            acdacd2 @KirAsh4
            last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • A Offline
              acdacd2
              last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • A Offline
                acdacd2
                last edited by

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • A Offline
                  acdacd2
                  last edited by

                  I’m using that code in php

                  $xml = simplexml_load_file('XML/status1.xml');
                  echo "<br>--------------<br>XML parsing <br>--------------<br>";
                  $result = array();
                  
                  foreach($xml->children() as $child){
                  $result[$child->getName()] = trim($child);
                  1 Reply Last reply Reply Quote 0
                  • strawberry 3.141S Offline
                    strawberry 3.141 Project Sponsor Module Developer
                    last edited by

                    have a look in here https://forum.magicmirror.builders/topic/240/soccer-standings i had also problems with cors so i used the request module in my node_helper to fix it

                    Please create a github issue if you need help, so I can keep track

                    1 Reply Last reply Reply Quote 0
                    • A Offline
                      acdacd2
                      last edited by

                      I copied the xml file on a synology web server, same behaviour status :0

                      1 Reply Last reply Reply Quote 0
                      • E Offline
                        Eunanibus Module Developer
                        last edited by

                        Thanks @strawberry-3-141 - I’ll take a look and see if there are any changes I can make.

                        1 Reply Last reply Reply Quote 0
                        • A Offline
                          acdacd2
                          last edited by acdacd2

                          I took contact with the provider, he advices me to use x-device techno?

                          1 Reply Last reply Reply Quote 0
                          • P Offline
                            Phate @acdacd2
                            last edited by

                            @acdacd2 said in http request:

                            some errors with nom install

                            pi@raspberrypi:~/MagicMirror/modules/default/MMM-HTTPRequestDisplay $ npm install
                            npm WARN enoent ENOENT: no such file or directory, open ‘/home/pi/MagicMirror/modules/package.json’
                            npm WARN enoent ENOENT: no such file or directory, open ‘/home/pi/MagicMirror/modules/node_modules/node_helper/package.json’
                            npm WARN modules No description
                            npm WARN modules No repository field.
                            npm WARN modules No README data
                            npm WARN modules No license field.

                            @KirAsh4

                            I’m having this same error with a module… What am I doing wrong… any hints much appreciated

                            1 Reply Last reply Reply Quote 0
                            • KirAsh4K Offline
                              KirAsh4 Moderator
                              last edited by KirAsh4

                              Does that module actually require an 'npm install' to be run? Don’t blindly run commands that you don’t know are actually necessary. You need to ask the author of that module how to properly install it, what the steps are, what’s needed, etc., etc. I know nothing of that module.

                              Edited to add: running an 'npm install' is generally only required if the specific module needs any additional node dependencies installed. However, the author would make this known. If it doesn’t say that anywhere, do not assume you have to do it yourself. You may end up causing more harm to your installation than good.

                              A Life? Cool! Where can I download one of those from?

                              1 Reply Last reply Reply Quote 1
                              • E Offline
                                Eunanibus Module Developer
                                last edited by

                                I’ve updated the ReadMe appropriately for this module, and this is available on the github page.

                                There are a few outstanding issues I need to address such as the calls to external domains (and a few other underlying issues), but I’m in the USA until the 6th of August and I won’t have time to address those issues until I return home.

                                Once the module is copied to the Modules folder, and the relevant config changes have been made, you shouldn’t need to “npm install” anything. You should simply be able to launch the MM software. No installations should be necessary. Be sure to read the Readme carefully, but if you can be more specific about the steps you have taken I can help you further.

                                P 1 Reply Last reply Reply Quote 0
                                • P Offline
                                  Phate @Eunanibus
                                  last edited by Phate

                                  @Eunanibus

                                  Sorry. Wasn’t clear. I’m having this same issue with another module.

                                  Am I correct that your http module isn’t working correctly yet?

                                  Been trying to get it to work. Should solve a lot of my module needs. Home automation statuses and data from import.io.

                                  Can’t wait 😃

                                  Enjoy the holiday.

                                  1 Reply Last reply Reply Quote 0
                                  • E Offline
                                    Eunanibus Module Developer
                                    last edited by

                                    There appears to be a cross domain issue with the module. I’m currently travelling and I’m going to make it a top priority when I return to repair it. In addition, I have a very cool module upcoming :)

                                    I’ll get the fix done as soon as I can guys. Sorry for the wait.

                                    In the meantime if you have access to the server side clients of your request, please look into making requests accepted from any source as a temporary fix.

                                    A 1 Reply Last reply Reply Quote 1
                                    • A Offline
                                      amanzimdwini @Eunanibus
                                      last edited by

                                      @Eunanibus

                                      Could you please post a SMALL example xml file?
                                      (Along with what I SHOULD see?)
                                      Everything I have tried
                                      (local xml file / file on NAS in local network / file from api.openweathermap.org/data/2.5/weather?id=2172797&APPID=**** )

                                      first gives me “Awaiting Results” and then “No Results” or “Failed Request”

                                      When I pull the stuff in my browser, I get the files. I’m banging into a wall here…

                                      Best would be if I could just pull a file from my local NAS. Once I have the correct format, I can write them all day long (live in SQL world)

                                      Thanks

                                      P 1 Reply Last reply Reply Quote 0
                                      • P Offline
                                        Phate @amanzimdwini
                                        last edited by

                                        @amanzimdwini

                                        He’s currently away. I think there’s a known issue he’s gonna fix when he gets home.

                                        I’ve also tried everything you have. Works in browser but not with module.

                                        Not too long to wait hopefully.

                                        1 Reply Last reply Reply Quote 0
                                        • foxF Offline
                                          fox
                                          last edited by

                                          Could someone please post a sample xml file that works?
                                          I dont know how to generate my xml file correctly.

                                          Issues With MMM-WatchDog known?

                                          https://forum.magicmirror.builders/post/29827

                                          Useful for PIR-Sensor: https://forum.magicmirror.builders/post/21299

                                          1 Reply Last reply Reply Quote 0

                                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                          With your input, this post could be even better 💗

                                          Register Login
                                          • 1
                                          • 2
                                          • 3
                                          • 3 / 3
                                          • First post
                                            Last post
                                          Enjoying MagicMirror? Please consider a donation!
                                          MagicMirror created by Michael Teeuw.
                                          Forum managed by Sam, technical setup by Karsten.
                                          This forum is using NodeBB as its core | Contributors
                                          Contact | Privacy Policy