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


PHP http_request函数代码示例

本文整理汇总了PHP中http_request函数的典型用法代码示例。如果您正苦于以下问题:PHP http_request函数的具体用法?PHP http_request怎么用?PHP http_request使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: select

 /**
  * retrieve list of stored sessions
  * @param {array} data received data query parameters
  * @param {boolean} ring: if true exclude "-- Sin asignar --" session 1
  * @return {array} session list in easyui json expected format, or error string
  */
 function select($data, $ring = false)
 {
     $this->myLogger->enter();
     //needed to properly handle multisort requests from datagrid
     $sort = getOrderString(http_request("sort", "s", ""), http_request("order", "s", ""), "Nombre ASC, Comentario ASC");
     // search string
     $search = isset($_GET['where']) ? strval($_GET['where']) : '';
     // evaluate offset and row count for query
     $page = http_request("page", "i", 1);
     $rows = http_request("rows", "i", 50);
     $limit = "";
     if ($page != 0 && $rows != 0) {
         $offset = ($page - 1) * $rows;
         $limit = "" . $offset . "," . $rows;
     }
     // if hidden==0 hide console related sessions
     $ringstr = " AND 1";
     if ($ring) {
         $ringstr = " AND (Sesiones.ID > 1)";
     }
     $searchstr = " AND 1";
     if ($search !== "") {
         $searchstr = "AND (Nombre LIKE '%{$search}%')  AND ( ( Comentario LIKE '%{$search}%' ) OR ( Operador LIKE '%{$search}%') ) ";
     }
     $hiddenstr = " AND 1";
     if ($data['Hidden'] == 0) {
         $hiddenstr = "AND (Nombre != 'Console')";
     }
     $result = $this->__select("Sesiones.ID AS ID,Nombre,Comentario,Operador,Prueba,Jornada,Manga,Tanda,Login,Background,LiveStream,LiveStream2,LiveStream3", "Sesiones,Usuarios", "( Sesiones.Operador = Usuarios.ID ) {$hiddenstr} {$searchstr} {$ringstr}", $sort, $limit);
     $this->myLogger->leave();
     return $result;
 }
开发者ID:nedy13,项目名称:AgilityContest,代码行数:38,代码来源:Sesiones.php

示例2: retrieveExcelFile

 public function retrieveExcelFile()
 {
     // phase 1 retrieve data from browser
     $this->myLogger->enter();
     $this->saveStatus("Loading file...");
     // extraemos los datos de registro
     $data = http_request("Data", "s", null);
     if (!$data) {
         return array("errorMsg" => "importExcel(dogs)::download(): No data to import has been received");
     }
     if (!preg_match('/data:([^;]*);base64,(.*)/', $data, $matches)) {
         return array("operation" => "upload", "errorMsg" => "importExcel(dogs)::download() Invalid received data format");
     }
     // mimetype for excel file is be stored at $matches[1]: and should be checked
     // $type=$matches[1]; // 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', or whatever. Not really used
     $this->myLogger->leave();
     $contents = base64_decode($matches[2]);
     // decodes received data
     // phase 2 store it into temporary file
     $tmpfile = tempnam_sfx(__DIR__ . "/../../../logs", "import", "xlsx");
     $file = fopen($tmpfile, "wb");
     fwrite($file, $contents);
     fclose($file);
     return array("operation" => "upload", "success" => true, "filename" => $tmpfile);
 }
开发者ID:nedy13,项目名称:AgilityContest,代码行数:25,代码来源:dog_reader.php

示例3: enumerate

 /**
  * Returns a json easyui datagrid style list of countries
  */
 function enumerate()
 {
     $data = array();
     // to be used on country search
     $q = strtolower(http_request("q", "s", ""));
     // parse country list
     foreach (Country::$countryList as $key => $val) {
         if ($q === "") {
             // no search key, just add
             array_push($data, array('ID' => $key, "Country" => $val));
             continue;
         }
         $k = strtolower($key);
         // search 2-letter country code
         if (strpos($k, $q) !== false) {
             array_push($data, array('ID' => $key, "Country" => $val));
             continue;
         }
         $v = strtolower($val);
         // search for country name
         if ($v === $q) {
             array_push($data, array('ID' => $key, "Country" => $val));
         }
     }
     $result = array('total' => count($data), 'rows' => $data);
     return $result;
 }
开发者ID:nedy13,项目名称:AgilityContest,代码行数:30,代码来源:Country.php

示例4: translate

function translate($string)
{
    $url = "http://fanyi.youdao.com/openapi.do?keyfrom=bj22222&key=136547222&type=data&doctype=json&version=1.1&q=";
    $str = http_request($url . $string);
    echo $url . $string;
    // $str=mb_convert_encoding($str,'GB2312','UTF-8');
    $pattern = '#translation\\":\\[\\"(.*)\\"\\]#';
    return getPatternResult($pattern, $str);
}
开发者ID:bajian,项目名称:js-web-skills,代码行数:9,代码来源:pic2text.php

示例5: main

function main($url, $user, $secret_key, $param)
{
    //加速乐开放API主函数
    ksort($param);
    $token = make_signiture($secret_key, $param);
    $header = make_header($user, $token);
    $postdata = http_build_query($param);
    $ret_cont = http_request($url, $postdata, $header);
    return $ret_cont;
}
开发者ID:xxl123,项目名称:jsl-open-api,代码行数:10,代码来源:api_test.php

示例6: select

 function select()
 {
     // evaluate offset and row count for query
     $q = http_request("q", "s", "");
     $c = http_request("Country", "s", "");
     $prov = $q !== "" ? "Provincia LIKE '%{$q}%'" : "1";
     $ctry = $c !== "" ? "AND Pais = '{$c}' " : "";
     $result = $this->__select("*", "Provincias", "({$prov} {$ctry}) OR ( Codigo=0 )", "Provincia ASC", "");
     return $result;
 }
开发者ID:nedy13,项目名称:AgilityContest,代码行数:10,代码来源:enumerate_Provincias.php

示例7: create_ticket

 function create_ticket($resource_url)
 {
     $service_url = $this->service_url . '/';
     //### FIXME: the server should be callable without this
     $data = array('resource_url' => $resource_url);
     $response = http_request($service_url, 'POST', $data);
     if (is_null($response) || $response[0] != 201) {
         return NULL;
     }
     return $this->_parse_ticket($response[1]);
 }
开发者ID:bufvc,项目名称:bufvc-potnia-framework,代码行数:11,代码来源:ironduke.lib.php

示例8: plugin_ajaxrss_output_url

function plugin_ajaxrss_output_url($url)
{
    if (!is_url($url, TRUE)) {
        return '';
    }
    $ret = http_request($url);
    if ($ret['rc'] != 200) {
        return '';
    }
    return $ret['data'];
}
开发者ID:aterai,项目名称:pukiwiki-plus-i18n,代码行数:11,代码来源:ajaxrss.inc.php

示例9: sendMediaMsg

function sendMediaMsg($fromUsername, $media_id, $type)
{
    $access_token = 'OqRc1B_r2iNAVtKLDT7FzUzN-fAN9q3chs1so3bAhUllLakfdGV9U--OpkV_B2cr3ZmJaPJjTI6kZvHvbfO79WenoxhMXl1gOJJ8UAovaQw';
    $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" . $access_token;
    $postData = '{
	"touser":"' . $fromUsername . '",
	"msgtype":"' . $type . '",
	"' . $type . '":{"media_id":"' . $media_id . '"   }
}';
    $result = http_request($url, $postData);
    return $result;
}
开发者ID:bajian,项目名称:js-web-skills,代码行数:12,代码来源:send.php

示例10: get_userinfo

 function get_userinfo($token)
 {
     //$created = substr_replace(get_date('Y-m-d\TH:i:sO', UTIME), ':', -2, 0);
     $created = str_replace('+0000', 'Z', gmdate('Y-m-d\\TH:i:sO', time()));
     $headers = array('X-JUGEMKEY-API-CREATED' => $created, 'X-JUGEMKEY-API-KEY' => $this->api_key, 'X-JUGEMKEY-API-TOKEN' => $token, 'X-JUGEMKEY-API-SIG' => hash_hmac('sha1', $this->api_key . $created . $token, $this->sec_key));
     $data = http_request(self::JUGEMKEY_URL_USER, 'GET', $headers);
     $this->response['rc'] = $data['rc'];
     if ($data['rc'] != 200 && $data['rc'] != 401) {
         return $this->response;
     }
     $this->responce_xml_parser($data['data']);
     return $this->response;
 }
开发者ID:logue,项目名称:pukiwiki_adv,代码行数:13,代码来源:AuthJugem.php

示例11: getOpenid

 /**
  * token换取用户的openid
  * 需要从威信回调本action : https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxea75c703e3c51ec3&redirect_uri=http%3A%2F%2F119.29.12.215%2FMobile%2FPublic%2Fbangding&response_type=code&scope=snsapi_base#wechat_redirect
  * redirect_uri 必须urlencode 处理。
  */
 private function getOpenid($jumpUrl = '')
 {
     //https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code
     $url = "https://api.weixin.qq.com/sns/oauth2/access_token";
     $getData['appid'] = C('AppID');
     $getData['secret'] = C('AppSecret');
     $code = I("get.code");
     if (!empty($code)) {
         $getData['code'] = $code;
     } else {
         $getData['code'] = $this->getToken($jumpUrl);
     }
     $getData['grant_type'] = "authorization_code";
     $data = http_request($getData, $url, false);
     $retArray = json_decode($data, true);
     $openid = $retArray['openid'];
     return $openid;
 }
开发者ID:simpboy,项目名称:api_weixin_out,代码行数:23,代码来源:PublicController.class.php

示例12: auth

 function auth($cert)
 {
     $api_sig = md5($this->sec_key . 'api_key' . $this->api_key . 'cert' . $cert);
     $url = HATENA_URL_XML . '?api_key=' . $this->api_key . '&cert=' . $cert . '&api_sig=' . $api_sig;
     $data = http_request($url);
     if ($data['rc'] != 200) {
         return array('has_error' => 'true', 'message' => $data['rc']);
     }
     $xml_parser = xml_parser_create();
     xml_parse_into_struct($xml_parser, $data['data'], $val, $index);
     xml_parser_free($xml_parser);
     foreach ($val as $x) {
         if ($x['type'] != 'complete') {
             continue;
         }
         $this->response[strtolower($x['tag'])] = $x['value'];
     }
     return $this->response;
 }
开发者ID:orangeal2o3,项目名称:pukiwiki-plugin,代码行数:19,代码来源:auth_hatena.cls.php

示例13: auth

 /**
  * 認証
  * @param string $cert
  * @return boolean
  */
 function auth($cert)
 {
     $query = array('api_key' => $this->api_key, 'api_sig' => $this->sig, 'cert' => $cert);
     $url = self::HATENA_URL_XML . http_build_query($query);
     $data = http_request($url);
     if ($data['rc'] != 200) {
         return array('has_error' => 'true', 'message' => $data['rc']);
     }
     $xml_parser = xml_parser_create();
     xml_parse_into_struct($xml_parser, $data['data'], $val, $index);
     xml_parser_free($xml_parser);
     foreach ($val as $x) {
         if ($x['type'] !== 'complete') {
             continue;
         }
         $this->response[strtolower($x['tag'])] = $x['value'];
     }
     return $this->response;
 }
开发者ID:logue,项目名称:pukiwiki_adv,代码行数:24,代码来源:AuthHatena.php

示例14: plugin_brokenlink_action

function plugin_brokenlink_action()
{
    global $vars, $_brokenlink_msg;
    $retval = array('msg' => $_brokenlink_msg['msg_title'], 'body' => '');
    if (empty($vars['page'])) {
        $retval['body'] = $_brokenlink_msg['msg_param_error'];
        return $retval;
    }
    // ユーザ認証されていない
    $id = Auth::check_auth();
    if (empty($id)) {
        $retval['body'] = $_brokenlink_msg['msg_not_access'];
        return $retval;
    }
    if (!exist_plugin('xbel')) {
        $retval['body'] = $_brokenlink_msg['msg_not_found_xbel'];
        return $retval;
    }
    $links = xbel::get_link_list($vars['page']);
    $data = '';
    foreach ($links as $href => $aname) {
        $rc = http_request($href, 'HEAD');
        switch ($rc['rc']) {
            case 200:
                // Ok
            // Ok
            case 301:
                // Moved Permanently
            // Moved Permanently
            case 401:
                // Unauthorized
                continue;
            default:
                $data .= '-[[' . $aname . '>' . $href . ']] (' . $rc['rc'] . ")\n";
        }
    }
    if ($data == '') {
        $data = $_brokenlink_msg['msg_all_ok'];
    }
    $retval['body'] = RendererFactorty::factory($data);
    return $retval;
}
开发者ID:logue,项目名称:pukiwiki_adv,代码行数:42,代码来源:brokenlink.inc.php

示例15: postLogin

 public function postLogin($args)
 {
     $username = Input::get('username');
     $password = Input::get('password');
     $this->validate(Input::all(), ['username' => 'required']);
     try {
         $user = new User();
         $user = $user->find(['username', '=', $username]);
         // dd($user);
         if (count($user) === 1) {
             if (Hash::check($password, $user->password)) {
                 Session::put(Config::get('session.name'), $user);
                 return is_ajax() ? http_request() : Redirect::to('/');
             }
         }
     } catch (\Exception $e) {
         throw $e;
     }
     return Redirect::back();
 }
开发者ID:eezhal92,项目名称:not-gojek,代码行数:20,代码来源:AuthController.php


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