Hello community, last hour I realized that PocketMine is not able to get contents from websites with a 'https' certivicate. I tryed \file_get_contents($url) and it returned this error: Code: Unable to find the wrapper "https" I made a other function to be sure that this really doesn't work. PHP: public function getcURL($url){ $curl = curl_init($url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_SSL_VERIFY_PEER, 0); curl_setopt($curl, CURLOPT_SSL_VERYIFY_HOST, 0); $data = curl_exec($curl); curl_close($curl); return $data; } Then I got Code: Use of undefined constant CURLOPT_SSL_VERIFY_PEER So, is it really possible to add the https wrapper to PocketMine e.g. via \bin\php\php.ini or is it impossible? Thanks for reading, S-
That works! But something with the encode is wrong. Still says I'm not connected to the Internet PHP: $logger = $this->getServer()->getLogger();$updateResult = print ($this->getcURL("http://raw.githubusercontent.com/Survingo/AutoUpdater/master/InternetTest.txt")); $logger->info("§aChecking Internet Connection..."); if($updateResult == "true"){ $logger->info("§aYou are connected to the Internet! Now checking for an Update..."); $this->checkForUpdate(); // Own very big and simple function with yaml_parse and else }else{ $logger->error("Can't check for an Update, because you are not connected to the Internet!"); }/* I removed from getcURL curl_setopt($curl, CURLOPT_SSL_VERIFY_PEER, 0);curl_setopt($curl, CURLOPT_SSL_VERYIFY_HOST, 0);*/ Should I better use something like !== false because it should return false if someone is not connected? The weird thing is: It logs §aYou are connected to the Internet! Now checking for an Update... AND Can't check for an Update, because you are not connected to the Internet!
PHP: public function onEnable(){$this->getLogger()->info("Checking for updates...");$r = \pocketmine\utils\Utils::getUrl("http://raw.githubusercontent.com/Survingo/AutoUpdater/master/InternetTest.txt", 5); // timeout: 5 if($r){ # Check update, Idk what your file holds :P } else { $this->getLogger()->info("Connection to update servers failed. Check your internet connection."); }}
Still doesn't work (lol). I tryed to run it directly onEnable() checkForUpdate() to test if I'm really not connected to the Internet/some errors, but it works... :|