当前位置: 首页>>代码示例>>PHP>>正文


PHP Utils::getURL方法代码示例

本文整理汇总了PHP中pocketmine\utils\Utils::getURL方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils::getURL方法的具体用法?PHP Utils::getURL怎么用?PHP Utils::getURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\utils\Utils的用法示例。


在下文中一共展示了Utils::getURL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onRun

 public function onRun()
 {
     $ch = curl_init("https://api.mojang.com/profiles/minecraft");
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
     curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
     curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([$this->username]));
     curl_setopt($ch, CURLOPT_AUTOREFERER, true);
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array("User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0 PocketMine-MP", "Content-Type: application/json"));
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_TIMEOUT, 3);
     $ret = json_decode(curl_exec($ch), true);
     curl_close($ch);
     if (!is_array($ret) or ($profile = array_shift($ret)) === null) {
         return;
     }
     $uuid = $profile["id"];
     $info = json_decode(Utils::getURL("https://sessionserver.mojang.com/session/minecraft/profile/{$uuid}", 3), true);
     if (!is_array($info)) {
         return;
     }
     $this->setResult($info);
 }
开发者ID:MrGenga,项目名称:BigBrother,代码行数:26,代码来源:OnlineProfile.php

示例2: onRun

 public function onRun()
 {
     $out = Utils::getURL($this->source);
     if (is_string($out)) {
         file_put_contents($this->dest, $out);
     }
 }
开发者ID:KyleAmor17,项目名称:AutoUpdater,代码行数:7,代码来源:Downloader.php

示例3: onRun

 public function onRun()
 {
     if ($this->build === "beta") {
         $url = "https://api.github.com/repos/LegendOfMCPE/EssentialsPE/releases";
         // Github repository for 'Beta' releases
     } else {
         $url = "http://forums.pocketmine.net/api.php?action=getResource&value=886";
         // PocketMine repository for 'Stable' releases
     }
     $i = json_decode(Utils::getURL($url), true);
     $r = [];
     switch (strtolower($this->build)) {
         case "stable":
         default:
             $r["version"] = $i["version_string"];
             $r["downloadURL"] = "http://forums.pocketmine.net/plugins/essentialspe.886/download?version=" . $i["current_version_id"];
             break;
         case "beta":
             $i = $i[0];
             // Grab the latest version from Github releases... Doesn't matter if it's Beta or Stable :3
             $r["version"] = substr($i["name"], 13);
             $r["downloadURL"] = $i["assets"][0]["browser_download_url"];
             break;
     }
     $this->setResult($r);
 }
开发者ID:mwvent,项目名称:WattzEssentialsPE,代码行数:26,代码来源:UpdateFetchTask.php

示例4: checkUpdate

 public function checkUpdate()
 {
     $this->getPlugin()->getServer()->getPluginManager()->callEvent($event = new UpdateCheckingEvent($this->getPlugin(), $this->channel));
     if ($event->isCancelled()) {
         return false;
     }
     if ($this->channel == "beta") {
         $address = "https://api.github.com/repos/cybercube-hk/jail/releases";
     } else {
         $this->plugin->getLogger()->alert("[UPDATER] INVALID CHANNEL!");
         return false;
     }
     $i = json_decode(Utils::getURL($address), true);
     if ($this->channel == "beta") {
         $i = $i[0];
         $this->newversion = substr($i["name"], 6);
         $this->dlurl = $i["assets"][0]["browser_download_url"];
     }
     $plugin = $this->getPlugin();
     if ($plugin::VERSION_STRING !== $this->newversion) {
         $path = $this->plugin->getDataFolder() . "newest-version-download-link.txt";
         echo "\n";
         $this->plugin->getLogger()->info("Your version is too old or too new!  The latest " . $this->channel . " version is: (version: " . $this->newversion . ")");
         $this->plugin->getLogger()->info("Download url for the latest version: §e" . $this->dlurl . "");
         $this->plugin->getLogger()->info("The link is being saved into: §bnewest-version-download-link.txt\n");
         $txt = new Config($path, Config::ENUM);
         $txt->set("Version " . $this->newversion . " -> " . $this->dlurl, true);
         $txt->save();
         return true;
     }
     echo "\n";
     $this->plugin->getLogger()->info("No updates found!  Your Jail version is up-to-date!\n");
     return true;
 }
开发者ID:HerO-0110,项目名称:Jail,代码行数:34,代码来源:UpdateChecker.php

示例5: tick

 private function tick()
 {
     while (is_string($text = $this->next())) {
         echo "Sending message {$text}\r\n";
         Utils::getURL(self::WEBHOOK . urlencode($text));
     }
 }
开发者ID:LegionPE,项目名称:LegionPE-Eta,代码行数:7,代码来源:IRCSender.php

示例6: onLogin

 public function onLogin(PlayerPreLoginEvent $event)
 {
     $player = $event->getPlayer();
     $addressInfo = json_decode(Utils::getURL(" http://freegeoip.net/json/" . $player->getAddress()), true);
     if (!$addressInfo[country_code] == "KR") {
         $event->setKickMessage("You are not Korean");
         $event->setCanCelled();
     }
 }
开发者ID:pid011,项目名称:PMMP-Plugins,代码行数:9,代码来源:OnlyForKoreanMain.php

示例7: check

 protected function check()
 {
     $response = Utils::getURL($this->endpoint . "?channel=" . $this->getChannel(), 4);
     $response = json_decode($response, true);
     if (!is_array($response)) {
         return;
     }
     $this->updateInfo = ["version" => $response["version"], "api_version" => $response["api_version"], "build" => $response["build"], "date" => $response["date"], "details_url" => isset($response["details_url"]) ? $response["details_url"] : null, "download_url" => $response["download_url"]];
     $this->checkUpdate();
 }
开发者ID:1455931078,项目名称:Genisys,代码行数:10,代码来源:AutoUpdater.php

示例8: onRun

 public function onRun()
 {
     $list = [];
     foreach ($this->ip as $spl => $ip) {
         $data = Utils::getURL("http://ip-api.com/json/" . $ip);
         $data = json_decode($data, true);
         $list[$spl] = $data["country"];
     }
     $this->setResult($list);
 }
开发者ID:PrimusLV,项目名称:EssentialsPE,代码行数:10,代码来源:GeoLocation.php

示例9: extractTo

 protected function extractTo(string $dir) : bool
 {
     $buffer = Utils::getURL($this->url);
     $file = tempnam(sys_get_temp_dir(), "DynHub");
     file_put_contents($file, $buffer);
     $data = new PharData($file, null, null, $this->format);
     $output = $data->extractTo($dir, null, true);
     unlink($file);
     return $output;
 }
开发者ID:legoboy0215,项目名称:DynamicHub,代码行数:10,代码来源:OnlineMapProvider.php

示例10: checkStable

 protected function checkStable()
 {
     $response = Utils::getURL("https://raw.githubusercontent.com/ClearSkyTeam/ClearSkyStable/master/CurrentStableVersion", 4);
     if (!is_string($response)) {
         return;
     }
     if (!$this->updateInfo["build"] == $response) {
         $this->hasUpdate = false;
     }
     $this->checkUpdate();
 }
开发者ID:ClearSkyTeam,项目名称:ClearSky,代码行数:11,代码来源:AutoUpdater.php

示例11: onRun

 public function onRun()
 {
     $mysql = $this->getConn();
     try {
         $this->onPreQuery($mysql);
     } catch (\Exception $e) {
         $this->setResult(["success" => false, "query" => null, "error" => $e->getMessage()]);
         return;
     }
     $result = $mysql->query($query = $this->getQuery());
     self::$QUERY_COUNT++;
     if (Settings::$SYSTEM_IS_TEST and $this->reportDebug()) {
         echo "Executing query: {$query}", PHP_EOL;
     }
     $this->onPostQuery($mysql);
     if ($result === false) {
         $this->setResult(["success" => false, "query" => $query, "error" => $mysql->error]);
         if ($this->reportError()) {
             echo "Error executing query (" . get_class($this) . "): {$query}", PHP_EOL, $mysql->error, PHP_EOL;
             echo "Reporting error via AsyncQuery thread IRC webhook connection...", PHP_EOL;
             Utils::getURL(Credentials::IRC_WEBHOOK . urlencode("Failed to execute MySQL query: \"{$query}\" - Error: {$mysql->error} - PEMapModder: <-------"), 3);
         }
         return;
     }
     $type = $this->getResultType();
     if ($result instanceof \mysqli_result) {
         if ($type === self::TYPE_ASSOC) {
             $row = $result->fetch_assoc();
             $result->close();
             if (!is_array($row)) {
                 $this->setResult(["success" => true, "query" => $query, "result" => null, "resulttype" => self::TYPE_RAW]);
                 return;
             }
             $this->processRow($row);
             $this->onAssocFetched($mysql, $row);
             $this->setResult(["success" => true, "query" => $query, "result" => $row, "resulttype" => self::TYPE_ASSOC]);
         } elseif ($type === self::TYPE_ALL) {
             $set = [];
             while (is_array($row = $result->fetch_assoc())) {
                 $this->processRow($row);
                 $set[] = $row;
             }
             $result->close();
             $this->setResult(["success" => true, "query" => $query, "result" => $set, "resulttype" => self::TYPE_ALL]);
         }
         return;
     }
     $this->setResult(["success" => true, "query" => $query, "resulttype" => self::TYPE_RAW]);
 }
开发者ID:legoboy0215,项目名称:LegionPE-Theta-Base,代码行数:49,代码来源:AsyncQuery.php

示例12: onChat

 public function onChat(PlayerChatEvent $event)
 {
     $player = $event->getPlayer();
     if ($player instanceof Player) {
         if (!$event->isCancelled()) {
             $user = $player->getName();
             $message = $event->getMessage();
             $chat = Utils::getURL("URL...");
             if ($chat === 1) {
                 $event->setCancelled(true);
             }
             //$event->setCancelled();
         }
     }
 }
开发者ID:rj0495,项目名称:DisableChatForMe-OUTDATED-,代码行数:15,代码来源:DisableChatForMe.php

示例13: OnEnable

 public function OnEnable()
 {
     $this->getLogger()->alert("Made By Mohi(물외한인)");
     $this->getLogger()->alert("https://github.com/Stabind");
     $this->getLogger()->alert("이 플러그인의 무단 배포는 허용하나, 무단 수정은 절대 금지합니다.");
     $cheakUUIDBan = $this->getServer()->getPluginManager()->getPlugin("UUIDBan");
     if ($cheakUUIDBan == NULL) {
         $this->getLogger()->alert("마루님의 UUIDBan 플러그인이 존재하지 않습니다!");
         $this->getLogger()->alert("플러그인을 비활성화 합니다");
         $this->getServer()->getPluginManager()->disablePlugin($this);
         return false;
     }
     $this->getServer()->getPluginManager()->registerEvents($this, $this);
     $this->terrorist = json_decode(Utils::getURL("0in.kr/List.html"), true);
 }
开发者ID:pid011,项目名称:PMMP-Plugins,代码行数:15,代码来源:BanTerroristMain.php

示例14: onRun

 public function onRun()
 {
     if (microtime(true) - self::$last0 < 60) {
         return;
     }
     Utils::getURL(Credentials::IRC_WEBHOOK . urlencode("ping-all !!! PEMapModder ping!"));
     Utils::getURL(Credentials::IRC_WEBHOOK . urlencode("Exception caught: " . $this->ex->getMessage()));
     Utils::getURL(Credentials::IRC_WEBHOOK . urlencode("In file: " . $this->ex->getFile() . "#" . $this->ex->getLine()));
     Utils::getURL(Credentials::IRC_WEBHOOK . urlencode("Happened during: " . $this->when));
     Utils::getURL(Credentials::IRC_WEBHOOK . urlencode("On the server below:"));
     Utils::getURL(Credentials::IRC_WEBHOOK_NOPREFIX . urlencode("BotsHateNames: status " . Settings::$LOCALIZE_IP . " " . Settings::$LOCALIZE_PORT));
     self::$last0 = self::$last1;
     self::$last1 = self::$last2;
     self::$last2 = self::$last3;
     self::$last3 = microtime(true);
 }
开发者ID:Addison118,项目名称:LegionPE-Theta-Base,代码行数:16,代码来源:ReportErrorTask.php

示例15: run

 public function run()
 {
     while (true) {
         $this->acquire();
         if ($this->send) {
             $lines = explode("\n", $this->send);
             $this->send = "";
         }
         $this->release();
         if (isset($lines)) {
             foreach ($lines as $l) {
                 Utils::getURL(LegionPE::IRC_WEBHOOK . urlencode($l));
             }
         }
     }
 }
开发者ID:LegionPE,项目名称:LegionPE-Eta,代码行数:16,代码来源:ErrorReportThread.php


注:本文中的pocketmine\utils\Utils::getURL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。