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


PHP Http::do_get方法代码示例

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


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

示例1: download

 public function download($save_dir, $save_filename, $ext = true)
 {
     $b = new Http();
     $b->do_get($this->url() . "&fmt=22");
     if (preg_match("/var[\\s]+swfArgs[\\s]*=[\\s]*(\\{.+?\\})/m", $b->body(), $match)) {
         $json = Text::parse_json($match[1]);
         $base_url = "http://www.youtube.com/get_video?video_id=" . $json["video_id"] . "&t=" . $json["t"];
         $url = $base_url . "&fmt=22";
         if ($b->do_head($url)->status() !== 200) {
             $url = $base_url . "&fmt=18";
         }
         $b->do_download($url, File::absolute($save_dir, $save_filename) . ($ext ? $this->ext : ""));
         return;
     }
     throw new Exception("undef video");
 }
开发者ID:hisaboh,项目名称:w2t,代码行数:16,代码来源:YouTubeDataResult.php

示例2: lookup

 /**
  * 短縮urlから復元する
  * @param $url
  * @return string
  */
 public static function lookup($url)
 {
     if (strpos($url, "http://tinyurl.com/") !== 0) {
         $url = "http://tinyurl.com/" . $url;
     }
     $http = new Http();
     $http->status_redirect(false);
     $http->do_get($url);
     if ($http->status() === 301 && preg_match("/Location:[ ](.*)/i", $http->head(), $redirect_url)) {
         return trim($redirect_url[1]);
     }
     return $url;
     /***
     			eq("http://rhaco.org",Tinyurl::lookup("http://tinyurl.com/6bkavu"));
     			eq("http://rhaco.org",Tinyurl::lookup("6bkavu"));			
     		 */
 }
开发者ID:hisaboh,项目名称:w2t,代码行数:22,代码来源:Tinyurl.php

示例3: download

 public function download($save_dir, $save_filename, $ext = true)
 {
     $b = new Http();
     if (!empty($this->original_image_url)) {
         $b->do_download($this->original_image_url, File::absolute($save_dir, $save_filename) . ($ext ? ".jpg" : ""));
         return;
     } else {
         $b->do_get($this->url);
         if (Tag::setof($tag, $b->body(), "body")) {
             foreach ($tag->in("script") as $s) {
                 if (preg_match("/addVariable\\('url', '(.+?)'\\)/", $s->value(), $match)) {
                     $b->do_download(trim($match[1]), File::absolute($save_dir, $save_filename) . ($ext ? ".flv" : ""));
                     return;
                 }
             }
         }
     }
     throw new Exception("undef video");
 }
开发者ID:hisaboh,项目名称:w2t,代码行数:19,代码来源:PhotozouSearchResult.php

示例4: __setup_rep__

 /**
  * Repositoryが提供するアプリケーションとライブラリの一覧を表示する
  * -rep rhaco.org
  */
 public static function __setup_rep__(Request $req, $value)
 {
     $http = new Http();
     $q = $req->in_vars("q");
     foreach (array("lib" => "Libraries:", "app" => "\nApplications:") as $type => $label) {
         if (Tag::setof($tag, $http->do_get(Repository::xml_url($type, $value)), "repository")) {
             $list = array();
             $max_length = 0;
             foreach ($tag->in("package") as $p) {
                 if (empty($q) || Text::imatch($p->in_param("name") . " " . $p->in_param("path") . " " . $p->in_param("summary") . " " . $p->value(), $q)) {
                     $list[] = $p;
                     if ($max_length < strlen($p->in_param("path"))) {
                         $max_length = strlen($p->in_param("path"));
                     }
                 }
             }
             if (!empty($list)) {
                 self::info_print($label);
                 foreach ($list as $p) {
                     self::println("  " . str_pad($p->in_param("path"), $max_length) . " " . $p->in_param("summary"));
                 }
             }
         }
     }
 }
开发者ID:satully,项目名称:dev_socialapp,代码行数:29,代码来源:Setup.php

示例5: server_address

 private static function server_address($url)
 {
     $server = $url;
     if (strpos($server, "://") === false) {
         $server = isset(self::$server_alias[$server]) ? self::$server_alias[$server] : "http://" . $server;
     }
     if (substr($server, -1) == "/") {
         $server = substr($server, 0, -1);
     }
     try {
         $http = new Http();
         if ($http->do_get($server . "/__repository__.php/check")->status() === 200 && $http->body() == "") {
             return $server;
         }
         if ($http->do_get($server . "/__repository__.xml")->status() === 200) {
             if (Tag::setof($tag, $http->body(), "map")) {
                 foreach ($tag->in("repository") as $rep) {
                     try {
                         if (!$rep->is_param("domain")) {
                             return self::server_address($rep->in_param("url"));
                         }
                     } catch (InvalidArgumentException $e) {
                     }
                 }
             }
         }
     } catch (InvalidArgumentException $e) {
     }
     throw new InvalidArgumentException("server `" . $url . "` not found");
 }
开发者ID:satully,项目名称:dev_socialapp,代码行数:30,代码来源:Repository.php


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