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


PHP Http::setMethod方法代码示例

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


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

示例1: __construct

 /**
  * Adds the WordPress hook during construction.
  *
  * @param \Herbert\Framework\Application $app
  * @param \Herbert\Framework\Http        $http
  */
 public function __construct(Application $app, Http $http)
 {
     $this->app = $app;
     $this->http = $http;
     if (!is_admin()) {
         return;
     }
     add_action('admin_menu', [$this, 'boot']);
     $http->setMethod($http->get('_method'), $old = $http->method());
     if (!in_array($http->method(), self::$methods)) {
         $http->setMethod($old);
     }
     if ($http->method() !== 'GET') {
         add_action('init', [$this, 'bootEarly']);
     }
 }
开发者ID:bigbitecreative,项目名称:wordpress-git-content,代码行数:22,代码来源:Panel.php

示例2: Http

<?php

// Include the Http Class
include_once 'class.http.php';
// Instantiate it
$http = new Http();
// Let's not use cURL
$http->useCurl(false);
// POST method
$http->setMethod('POST');
// POST parameters
$http->addParam('user_name', 'yourusername');
$http->addParam('password', 'yourpassword');
// Referrer
$http->setReferrer('https://yourproject.projectpath.com/login');
// Get basecamp dashboard (HTTPS)
$http->execute('https://yourproject.projectpath.com/login/authenticate');
// Show result page or error if occurred
echo $http->error ? $http->error : $http->result;
开发者ID:rainbow-studio,项目名称:cmsms,代码行数:19,代码来源:test_basecamp.php

示例3: delete

 /**
  * @param $url              string      Url a la cual se generara la peticion
  * @param $auth             string      Cadena de autentificacion
  * @param $data             string      Parametros a enviar
  * @param array  $headers               Arreglo de headers http
  * @return mixed
  * @throws \Exception
  */
 public static function delete($url, $auth, $data = null, $headers = array())
 {
     $ch = Http::initHttp($url);
     Http::setMethod($ch, 'DELETE');
     Http::setAuth($ch, $auth);
     if (!empty($data)) {
         Http::setPostFields($ch, $data);
     }
     Http::setHeaders($ch, $headers);
     $response = Http::execHttp($ch);
     if (empty($response)) {
         throw new \Exception("Respuesta vacia");
     } else {
         return $response;
     }
 }
开发者ID:compropago,项目名称:plugin-magento-2,代码行数:24,代码来源:Rest.php

示例4: request

 function request($url = "", $method = "GET", $params = NULL)
 {
     //#4 FIX: Don't use token on PLAINTEXT signature
     $token = $this->signature instanceof OAuthSignatureMethod_PLAINTEXT ? NULL : $this->token;
     $request = OAuthRequest::from_consumer_and_token($this->consumer, $token, $method, $url, $params);
     $request->sign_request($this->signature, $this->consumer, $token);
     $http = new Http();
     $http->setMethod($method);
     switch ($method) {
         case 'GET':
             $url = $request->to_url();
             break;
         default:
             parse_str($request->to_postdata(), $params);
             $http->setParams($params);
             $url = $request->get_normalized_http_url();
             break;
     }
     $http->execute($url);
     return $http->error ? die($http->error) : $http->result;
 }
开发者ID:kisscms,项目名称:oauth,代码行数:21,代码来源:kiss_oauth.php

示例5: api_trafficrequest_cb

function api_trafficrequest_cb($id, $type)
{
    if (getconfig_var('allow_statistical_info') != 1) {
        return true;
    }
    // Include the Http Class
    require_once MAD_PATH . '/modules/http/class.http.php';
    // Instantiate it
    $http = new Http();
    $http->setMethod('GET');
    $http->addParam('install_id', getconfig_var('installation_id'));
    $http->addParam('requestid', get_actual_tr_id($id));
    $http->addParam('status', $type);
    $http->execute('http://network.madserve.org/request_accept.php');
    if ($http->error) {
        return false;
    }
    return true;
}
开发者ID:aiurlano,项目名称:mAdserve-Fork,代码行数:19,代码来源:admin_functions.php

示例6: compileJS

 function compileJS($scripts)
 {
     // make this a config option?
     $baseUrl = "assets/js/";
     $http = new Http();
     $http->setMethod('GET');
     // sort results
     //ksort_recursive( $minify );
     // record signature
     //$md5 = "";
     $cache_path = $this->_getCacheDir() . "{$baseUrl}";
     // FIX: create the dir if not available
     if (!is_dir($cache_path)) {
         mkdir($cache_path, 0775, true);
     }
     // process each group
     foreach ($scripts as $name => $group) {
         $first = current($group);
         $result = "";
         $timestamp = 0;
         // go to next group if minify flag is not true
         if (!$first["data"]['minify']) {
             continue;
         }
         $min = new UglifyJS();
         $min->cacheDir($cache_path);
         $min->compiler($GLOBALS['config']['admin']['uglify_service']);
         // get the encoding from the first member of the group
         $encode = $first["data"]["encode"];
         // loop through the group and add the files
         foreach ($group as $script) {
             // the move the domain from the script (if available)
             // check if it's a local url
             $href = $script["src"];
             $local = substr($href, 0, 4) !== "http" || substr($href, 0, 2) !== "//";
             if ($local) {
                 $href = url($href);
             }
             $result .= $http->execute($href);
             // get modified time
             $mtime = urlmtime($href);
             // compare with newest file in the group
             if ($timestamp < $mtime) {
                 $timestamp = $mtime;
             }
             //$src = str_replace( array(url(), cdn() ),"", $script["src"] );
             // remove leading slash
             //$src = ltrim($src,'/');
             //$md5 .= md5_file($file);
         }
         // compress signatures of all files
         $md5 = md5($result);
         // set timestamp
         $min->timestamp($timestamp);
         //contents of each group are saved in a tmp file
         $tmp_file = $cache_path . "tmp.{$md5}.js";
         file_put_contents($tmp_file, $result);
         // add tmp file
         $min->add($tmp_file);
         //$min->setFile( "$name.$md5.min" );
         $min->setFile("{$name}");
         if (!DEBUG) {
             $min->quiet()->hideDebugInfo();
         }
         // condition the method of minification here...
         switch ($encode) {
             case "whitespace":
                 $min->whitespaceOnly();
                 break;
             case "simple":
                 $min->simpleMode();
                 break;
             case "advanced":
                 $min->advancedMode();
                 break;
             default:
                 $min->simpleMode();
                 break;
         }
         $min->write();
         $min->clear();
         // add the signature in the group
         //$scripts[$name][]["data"]["md5"] = $md5;
     }
     return $scripts;
 }
开发者ID:makesites,项目名称:kisscms,代码行数:86,代码来源:minify.php


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