1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved External config?

Discussion in 'Development' started by ExZe, Mar 8, 2020.

  1. ExZe

    ExZe Silverfish

    Messages:
    21
    GitHub:
    mzztin
    Sooo my question is, if it is possible to get a config e.g. from a github file to a PocketMine plugin?
    If yes how?
     
  2. ExZe

    ExZe Silverfish

    Messages:
    21
    GitHub:
    mzztin
    If anybody reading this I used this code and it worked:
    PHP:
            $file file_get_contents("https://link.com/file.json");
            
    $this->ver json_decode($filetrue);
     
    Primus likes this.
  3. TwistedAsylumMC

    TwistedAsylumMC Slime

    Messages:
    96
    GitHub:
    twistedasylummc
    Using a cURL request would be much faster than file_get_contents across the web, but if you do use cURL, make sure to do it in an async task.
     
    Primus likes this.
  4. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    (you should't use file_get_contents on an URL while the game is running either)
    But if you're using it in your onEnable and it's integral for your plugin to function you don't need to make it Async unless server startup time is your highest priority.
     
    Primus likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.