We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22303 MODX Staff
    • 10,725 Posts
    You have to have allow_fopen_url enabled on your server to be able to use the function with a URL.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I found that my server's file_get_contents functionality worked OK on test files.
      I would presume that this means that it is enabled.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 25046
        • 194 Posts
        Yes, I viewed the PHP.ini file and confirmed that allow_url_fopen is set to ON.
          • 25046
          • 194 Posts
          I went through the ModX log files as you suggested and here was a typical error entry:

          Use of undefined constant E_USER_DEPRECATED - assumed 'E_USER_DEPRECATED'
          « MODX Parse Error »
          MODX encountered the following error while attempting to parse the requested resource:
          « PHP Parse Error »
          PHP error debug
          Error : file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
          ErrorType[num] : WARNING[2]
          File : /home/--------/public_html/manager/includes/document.parser.class.inc.php(828) : eval()'d code
          Line : 13

          As is usual, I have no idea what this all means or what I should do about it. Would appreciate more suggestions if there are some. Thanks
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Hm. Try something. Edit the snippet and put this at the very top:
            <?php
            return $_GET['p'];
            

            and see what it does. You should see the value of the &p=xyz in your page.

            By the way, all of those values should be checked to make sure they are what is expected, such as "p" being an integer. Otherwise nasty people can send URLs with all kinds of nasty things in those values.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 25046
              • 194 Posts
              I tried this and things changed. The "Error" page no longer displays, which is positive. Instead, it just displays my blank ModX template page, only without the content it should be pulling in.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Ok, that means that there is something wrong with the snippet. It should display the value of your p=whatever in the URL. What does the Reports -> Error Reports say now?
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 25046
                  • 194 Posts
                  It no longer generates an error in the log.
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    Is there a ?p=whatever in the URL you are using to access the page?
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 25046
                      • 194 Posts
                      No, but I bet there should be. Right now, the page URL is like this:

                      www<dot>ourcompany.ca/partners/othercompany.html

                      No "?p="