當前位置: 首頁>>代碼示例>>PHP>>正文


PHP http::get方法代碼示例

本文整理匯總了PHP中http::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP http::get方法的具體用法?PHP http::get怎麽用?PHP http::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在http的用法示例。


在下文中一共展示了http::get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: fileadded

 public function fileadded($id)
 {
     $files = tfiles::i();
     $item = $files->getitem($id);
     if ('image' != $item['media']) {
         return;
     }
     $fileurl = $files->geturl($id);
     if ($s = http::get('http://www.smushit.com/ysmush.it/ws.php?img=' . urlencode($fileurl))) {
         $json = json_decode($s);
         if (isset($json->error) || -1 === (int) $json->dest_size || !$json->dest) {
             return;
         }
         $div = $item['size'] - (int) $json->dest_size;
         if ($div / ($item['size'] / 100) < 3) {
             return;
         }
         $dest = urldecode($json->dest);
         if (!strbegin($dest, 'http')) {
             $dest = 'http://www.smushit.com/' . $dest;
         }
         if ($content = http::get($dest)) {
             return $files->setcontent($id, $content);
         }
     }
 }
開發者ID:laiello,項目名稱:litepublisher,代碼行數:26,代碼來源:smushit.plugin.php

示例2: processform

 public function processform()
 {
     $plugin = tsourcefiles::i();
     if (isset($_POST['download'])) {
         set_time_limit(300);
         $version = litepublisher::$options->version;
         if (!(($s = http::get("http://litepublisher.googlecode.com/files/litepublisher.{$version}.tar.gz")) || ($s = http::get("http://litepublisher.com/download/litepublisher.{$version}.tar.gz")))) {
             return 'Error download';
         }
         tbackuper::include_tar();
         $tar = new tar();
         $tar->loadfromstring($s);
         if (!is_array($tar->files)) {
             unset($tar);
             return 'Invalid file archive';
         }
         tfiler::delete($plugin->root, true, false);
         foreach ($tar->files as $item) {
             $filename = $plugin->root . $item['name'];
             $dir = dirname($filename);
             if (!is_dir($dir)) {
                 $this->mkdir($dir);
             }
             file_put_contents($filename, $item['file']);
             @chmod($filename, 0666);
         }
         unset($tar);
         $plugin->reread();
     } elseif (isset($_POST['reread'])) {
         $plugin->reread();
     } else {
         $plugin->root = $_POST['root'];
         $plugin->save();
     }
 }
開發者ID:laiello,項目名稱:litepublisher,代碼行數:35,代碼來源:admin.sourcefiles.class.php

示例3: processform

 public function processform()
 {
     if (!isset($_POST['contactvalue'])) {
         return '';
     }
     $time = substr($_POST['contactvalue'], strlen('_contactform'));
     if (time() > $time) {
         return $this->errmesg;
     }
     $email = trim($_POST['email']);
     if (!tcontentfilter::ValidateEmail($email)) {
         return sprintf('<p><strong>%s</strong></p>', tlocal::get('comment', 'invalidemail'));
     }
     $url = trim($_POST['site']);
     if (empty($url) || strbegin($url, litepublisher::$site->url)) {
         return $this->errmesg;
     }
     if ($s = http::get($url)) {
         if (!strpos($s, '<meta name="generator" content="Lite Publisher')) {
             return $this->errmesg;
         }
     } else {
         return $this->errmesg;
     }
     $content = trim($_POST['content']);
     if (strlen($content) <= 15) {
         return sprintf('<p><strong>%s</strong></p>', tlocal::get('comment', 'emptycontent'));
     }
     $content = "{$url}\n" . $_POST['sitetitle'] . "\n\n" . $content;
     tmailer::sendmail('', $email, '', litepublisher::$options->email, $this->subject, $content);
     return $this->success;
 }
開發者ID:laiello,項目名稱:litepublisher,代碼行數:32,代碼來源:contactsite.class.php

示例4: __call

 public function __call($method, $params = array())
 {
     $params = $params['0'];
     $params['action'] = $method;
     $params['appid'] = $this->appid;
     $params['format'] = 'json';
     $params['datetime'] = $_SERVER['REQUEST_TIME'];
     $params['sign'] = $this->sign($params);
     //自動重試5次 防止失敗!
     for ($i = 0; $i < 5; $i++) {
         $data = json_decode(http::get($this->apiurl, $params), true);
         if (is_array($data) && $data['status'] != 0) {
             break;
         }
     }
     if (is_array($data)) {
         if ($data['status'] == 1) {
             return $data['data'];
         } else {
             exit('采集錯誤!原因:' . $data['msg'] . ' 參數:<pre>' . var_export($params, true) . '</pre>');
         }
     } else {
         exit('采集錯誤!方法' . $method . ' 參數:<pre>' . var_export($params, true) . '</pre>');
     }
 }
開發者ID:oohook,項目名稱:PTFrameWork,代碼行數:25,代碼來源:apiclient.php

示例5: parse

 public static function parse($url)
 {
     if ($s = http::get($url)) {
         $backuper = tbackuper::i();
         $archtype = $backuper->getarchtype($url);
         if ($files = $backuper->unpack($s, $archtype)) {
             list($filename, $content) = each($files);
             if ($about = self::getabout($files)) {
                 $item = new tdownloaditem();
                 $item->type = strbegin($filename, 'plugins/') ? 'plugin' : 'theme';
                 $item->title = $about['name'];
                 $item->downloadurl = $url;
                 $item->authorurl = $about['url'];
                 $item->authorname = $about['author'];
                 $item->rawcontent = $about['description'];
                 $item->version = $about['version'];
                 $item->tagnames = empty($about['tags']) ? '' : trim($about['tags']);
                 if ($screenshot = self::getfile($files, 'screenshot.png')) {
                     $media = tmediaparser::i();
                     $idscreenshot = $media->uploadthumbnail($about['name'] . '.png', $screenshot);
                     $item->files = array($idscreenshot);
                 }
                 return $item;
             }
         }
     }
     return false;
 }
開發者ID:laiello,項目名稱:litepublisher,代碼行數:28,代碼來源:about.parser.class.php

示例6: call

 /**
  * 組裝接口調用參數 並調用接口
  *
  * @param  string $api    微博API
  * @param  array $param   調用API的額外參數
  * @param  string $method HTTP請求方法 默認為GET
  * @param  bool $multi
  * @return string json
  */
 public function call($api, $param = array(), $method = 'GET', $multi = false)
 {
     /* 騰訊QQ調用公共參數 */
     $params = array('access_token' => $this->token);
     $params = array_merge($params, $param);
     $data = http::get($this->apiBase . $api, $params);
     return json_decode($data, true);
 }
開發者ID:oohook,項目名稱:PTFrameWork,代碼行數:17,代碼來源:weibo.php

示例7: ticket

 /**
  * Get jsticket.
  *
  * @return string
  */
 public function ticket()
 {
     $key = self::TICKET_CACHE_PREFIX . $this->appId;
     return $this->cache->get($key, function ($key) {
         $result = $this->http->get(self::API_TICKET);
         $this->cache->set($key, $result['ticket'], $result['expires_in'] - 500);
         return $result['ticket'];
     });
 }
開發者ID:raymonder,項目名稱:wechat,代碼行數:14,代碼來源:Js.php

示例8: getTicket

 /**
  * Get jsticket.
  *
  * @return string
  */
 public function getTicket()
 {
     $key = 'overtrue.wechat.jsapi_ticket.' . $this->appId;
     return $this->cache->get($key, function ($key) {
         $result = $this->http->get(self::API_TICKET);
         $this->cache->set($key, $result['ticket'], $result['expires_in'] - 100);
         return $result['ticket'];
     });
 }
開發者ID:heyjun,項目名稱:wechat,代碼行數:14,代碼來源:SDK.php

示例9: getOpenId

 /**
  * 獲取openid
  * @return mixed
  * @throws Exception
  */
 public function getOpenId()
 {
     if ($this->openid) {
         return $this->openid;
     }
     $data = http::get($this->apiBase . 'oauth2.0/me', array('access_token' => $this->token));
     $data = json_decode(trim(substr($data, 9), " );\n"), true);
     if (isset($data['openid'])) {
         $this->openid = $data['openid'];
         return $data['openid'];
     } else {
         throw new Exception("獲取用戶openid出錯:{$data['error_description']}");
     }
 }
開發者ID:oohook,項目名稱:PTFrameWork,代碼行數:19,代碼來源:qq.php

示例10: request

 public function request($arg)
 {
     if ($err = parent::request($arg)) {
         return $err;
     }
     $code = $_REQUEST['code'];
     $resp = http::post('https://oauth.yandex.ru/token', array('code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'grant_type' => 'authorization_code'));
     if ($resp) {
         $tokens = json_decode($resp);
         if ($r = http::get('https://login.yandex.ru/info?format=json&oauth_token=' . $tokens->access_token)) {
             $info = json_decode($r);
             return $this->adduser(array('service' => $this->name, 'uid' => $info->id, 'email' => isset($info->default_email) ? $info->default_email : $info->emails[0], 'name' => isset($info->real_name) ? $info->real_name : $info->display_name), $info);
         }
     }
     return $this->errorauth();
 }
開發者ID:laiello,項目名稱:litepublisher,代碼行數:16,代碼來源:yandex.service.php

示例11: request

 public function request($arg)
 {
     if ($err = parent::request($arg)) {
         return $err;
     }
     $code = $_REQUEST['code'];
     $resp = http::post('https://accounts.google.com/o/oauth2/token', array('code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'redirect_uri' => litepublisher::$site->url . $this->url, 'grant_type' => 'authorization_code'));
     if ($resp) {
         $tokens = json_decode($resp);
         if ($r = http::get('https://www.googleapis.com/oauth2/v1/userinfo?access_token=' . $tokens->access_token)) {
             $info = json_decode($r);
             return $this->adduser(array('service' => $this->name, 'email' => isset($info->email) ? $info->email : '', 'name' => $info->name, 'website' => isset($info->link) ? $info->link : ''), $info);
         }
     }
     return $this->errorauth();
 }
開發者ID:laiello,項目名稱:litepublisher,代碼行數:16,代碼來源:google.service.php

示例12: request

 public function request($arg)
 {
     if ($err = parent::request($arg)) {
         return $err;
     }
     $code = $_REQUEST['code'];
     $resp = http::get('https://graph.facebook.com/oauth/access_token?' . http_build_query(array('code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'redirect_uri' => litepublisher::$site->url . $this->url)));
     if ($resp) {
         $params = null;
         parse_str($resp, $params);
         if ($r = http::get('https://graph.facebook.com/me?access_token=' . $params['access_token'])) {
             $info = json_decode($r);
             return $this->adduser(array('service' => $this->name, 'uid' => isset($info->id) ? $info->id : '', 'email' => isset($info->email) ? $info->email : '', 'name' => $info->name, 'website' => isset($info->link) ? $info->link : ''), $info);
         }
     }
     return $this->errorauth();
 }
開發者ID:laiello,項目名稱:litepublisher,代碼行數:17,代碼來源:facebook.service.php

示例13: request

 public function request($arg)
 {
     if ($err = parent::request($arg)) {
         return $err;
     }
     $code = $_REQUEST['code'];
     $resp = http::post('https://oauth.vk.com/access_token', array('code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'redirect_uri' => litepublisher::$site->url . $this->url));
     if ($resp) {
         $tokens = json_decode($resp);
         if ($r = http::get('https://api.vk.com/method/getProfiles?uids=' . $tokens->user_id . '&access_token=' . $tokens->access_token)) {
             $js = json_decode($r);
             $info = $js->response[0];
             return $this->adduser(array('service' => $this->name, 'uid' => $info->uid, 'name' => $info->first_name . ' ' . $info->last_name, 'website' => 'http://vk.com/id' . $info->uid), $info);
         }
     }
     return $this->errorauth();
 }
開發者ID:laiello,項目名稱:litepublisher,代碼行數:17,代碼來源:vkontakte.service.php

示例14: request

 public function request($arg)
 {
     if ($err = parent::request($arg)) {
         return $err;
     }
     $code = $_REQUEST['code'];
     $resp = http::post('https://connect.mail.ru/oauth/token', array('code' => $code, 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'redirect_uri' => litepublisher::$site->url . $this->url, 'grant_type' => 'authorization_code'));
     if ($resp) {
         $tokens = json_decode($resp);
         $params = array('method' => 'users.getInfo', 'app_id' => $this->client_id, 'session_key' => $tokens->access_token, 'uids' => $tokens->x_mailru_vid, 'secure' => '1', 'format' => 'json');
         ksort($params);
         $params['sig'] = $this->sign($params, $this->client_secret);
         if ($r = http::get('http://www.appsmail.ru/platform/api?' . http_build_query($params))) {
             $js = json_decode($r);
             $info = $js[0];
             return $this->adduser(array('uid' => $info->uid, 'email' => isset($info->email) ? $info->email : '', 'name' => $info->nick, 'website' => isset($info->link) ? $info->link : ''), $info);
         }
     }
     return $this->errorauth();
 }
開發者ID:laiello,項目名稱:litepublisher,代碼行數:20,代碼來源:mailru.service.php

示例15: query

 function query($args, $document)
 {
     $this->validate($args);
     $xml = new xml();
     $get = [];
     foreach ($this->get as $name => $value) {
         $get[$name] = vars::apply_assoc($value, $args);
     }
     switch ($this->method) {
         case 'get':
             return self::to_xml(http::get($this->url, $get, $this->datasource['username'], $this->datasource['password']));
         case 'post':
             $post = [];
             foreach ($this->post as $name => $value) {
                 $post[$name] = vars::apply_assoc($value, $args);
             }
             return self::to_xml(http::post($this->url, $post, $get, $this->datasource['username'], $this->datasource['password']));
         default:
             runtime_error('Unknown HTTP procedure method: ' . $this->method);
     }
 }
開發者ID:nyan-cat,項目名稱:easyweb,代碼行數:21,代碼來源:http_procedure.php


注:本文中的http::get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。