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


PHP http_post函数代码示例

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


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

示例1: flickr_api_call

function flickr_api_call($method, $args = array(), $more = array())
{
    list($url, $args) = flickr_api_call_build($method, $args, $more);
    $defaults = array('http_timeout' => 10);
    $more = array_merge($defaults, $more);
    $headers = array();
    $rsp = http_post($url, $args, $headers, $more);
    # $url = $url . "?" . http_build_query($args);
    # $rsp = http_get($url);
    if (!$rsp['ok']) {
        return $rsp;
    }
    if (isset($more['raw'])) {
        return $rsp;
    }
    $json = json_decode($rsp['body'], 'as a hash');
    if (!$json) {
        return array('ok' => 0, 'error' => 'failed to parse response');
    }
    if ($json['stat'] != 'ok') {
        return array('ok' => 0, 'error' => $json['message']);
    }
    unset($json['stat']);
    return array('ok' => 1, 'rsp' => $json);
}
开发者ID:nvkelso,项目名称:reverse-geoplanet,代码行数:25,代码来源:lib_flickr_api.php

示例2: addMask

 public function addMask()
 {
     if ($_SERVER['REQUEST_METHOD'] === 'GET') {
         $view = M('view', Null, 'DB_NEWS');
         $vlist = $view->select();
         $this->assign('vlist', $vlist);
         $this->display();
     } else {
         if (!empty($_POST['viewid']) && !empty($_POST['mask'])) {
             $view_mask = M('view_mask', Null, 'DB_NEWS');
             $str = trim($_POST['mask']);
             $arr = explode(',', $str);
             for ($i = 0; $i < count($arr); $i++) {
                 if (!empty($arr[$i])) {
                     $mask['network'] = $arr[$i];
                     $mask['viewid'] = $_POST['viewid'];
                     $is_ok = $view_mask->data($mask)->add();
                     if ($is_ok === false) {
                         $this->ajaxReturn('error', '添加掩码失败,请联系管理员。', 0);
                     }
                     $val = array("mask" => $arr[$i], "vid" => $_POST["viewid"]);
                     $user = array("cid" => $_SESSION['id'], "level" => 2, "info" => "");
                     $param = array("type" => "mask", "opt" => "add", "data" => $val, "user" => $user);
                     $ret = http_post(C('INTERFACE_URL') . "/dnspro/dnsbroker/", $param);
                     $rslt = json_decode($ret["content"], true);
                     if ($rslt["ret"] != 0) {
                         $this->ajaxReturn(0, $rslt["content"], 0);
                     }
                 }
             }
             $this->ajaxReturn(1, 'success', 1);
         }
     }
 }
开发者ID:superman1982,项目名称:ddd,代码行数:34,代码来源:RunmgrAction.class.php

示例3: prepareForTheFeature

 /** @BeforeFeature */
 public static function prepareForTheFeature()
 {
     @http_delete(ELASTICSEARCH . '/cncflora_test0', []);
     @http_delete(ELASTICSEARCH . '/cncflora_test1', []);
     @http_delete(COUCHDB . '/cncflora_test0', []);
     @http_delete(COUCHDB . '/cncflora_test1', []);
     @http_put(ELASTICSEARCH . '/cncflora_test0', []);
     @http_put(ELASTICSEARCH . '/cncflora_test1', []);
     @http_put(COUCHDB . '/cncflora_test0', []);
     @http_put(COUCHDB . '/cncflora_test1', []);
     $file = file_get_contents(__DIR__ . "/load.json");
     $json = json_decode($file);
     $r = http_post(COUCHDB . "/cncflora_test0/_bulk_docs", array('docs' => $json));
     foreach ($json as $doc) {
         $doc->id = $doc->_id;
         foreach ($r as $revs) {
             if ($revs->id == $doc->_id) {
                 $doc->rev = $revs->rev;
                 $doc->_rev = $revs->rev;
             }
         }
         http_put(ELASTICSEARCH . '/cncflora_test0/' . $doc->metadata->type . '/' . $doc->_id, $doc);
     }
     sleep(1);
 }
开发者ID:CNCFlora,项目名称:sig,代码行数:26,代码来源:FeatureContext.php

示例4: weixin_send_custom_message

function weixin_send_custom_message($from_user, $msg)
{
    $access_token = get_weixin_token();
    $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={$access_token}";
    $msg = str_replace('"', '\\"', $msg);
    $post = '{"touser":"' . $from_user . '","msgtype":"text","text":{"content":"' . $msg . '"}}';
    http_post($url, $post);
}
开发者ID:jasonhzy,项目名称:bjcms2.3,代码行数:8,代码来源:lib_weixin.php

示例5: geekmail_make_preview

/** 
 * Use the geekmail 'preview' to convert BGG markup to HTML
 * 
 * $recipients = a comma-seperated list of BGG usernames
 * $subject = the subject line of the geekmail
 * $message = the content of the geekmail
 *
 * Returns TRUE on success and FALSE on failure.
 */
function geekmail_make_preview($message)
{
    global $config;
    $url = "https://" . $config['bgg']['domain'] . "/geekmail_controller.php";
    $params = array('action' => 'save', 'messageid' => '', 'touser' => $config['bgg']['username'], 'subject' => 'Citizen Recognition Preview', 'savecopy' => 1, 'geek_link_select_1' => '', 'sizesel' => 10, 'body' => $message, 'B1' => 'Preview', 'label' => '', 'ajax' => 1);
    $result = http_post($url, $params, $config['bgg']['cookie']);
    return $result;
}
开发者ID:scraimer,项目名称:bgggcr,代码行数:17,代码来源:geekmail.inc.php

示例6: http_send

function http_send($url, $data = '')
{
    $result = null;
    if (empty($data)) {
        $result = http_get($url);
    } else {
        $result = http_post($url, $data);
    }
    return $result;
}
开发者ID:sdgdsffdsfff,项目名称:stplatform,代码行数:10,代码来源:http_helper.php

示例7: flickr_api_call

function flickr_api_call($method, $args = array(), $more = array())
{
    list($url, $args) = flickr_api_call_build($method, $args, $more);
    $defaults = array('http_timeout' => 10);
    $more = array_merge($defaults, $more);
    $headers = array();
    $rsp = http_post($url, $args, $headers, $more);
    # $url = $url . "?" . http_build_query($args);
    # $rsp = http_get($url);
    return flickr_api_parse_response($rsp);
}
开发者ID:nilswalk,项目名称:parallel-flickr,代码行数:11,代码来源:lib_flickr_api.php

示例8: oauth

 /**
  * jsapi配置
  * @return array
  */
 public function oauth()
 {
     $code = $this->code = get('code');
     $redirect_uri = get('redirect_uri', '');
     $redirect_uri = urldecode($redirect_uri);
     $query = array('client_secret' => $this->appsecret, 'client_id' => $this->appid, 'grant_type' => 'authorization_code', 'redirect_uri' => $redirect_uri, 'code' => $code);
     $token_info_josn = http_post('https://login.uber.com.cn/oauth/v2/token', $query);
     echo $token_info_josn;
     $token_info = json_decode($token_info_josn, true);
     var_dump($token_info);
     exit;
 }
开发者ID:wkgg,项目名称:uberHacker,代码行数:16,代码来源:uber.php

示例9: execPayment

/**
 * @param Array $fomrs
 * @param Boolean $useSSL
 * @return response string
 */
function execPayment($fomrs, $useSSL)
{
    $gofpay_gateway_url = trim(Configuration::get('GOFPAY_GATEWAY_URL')) . '/' . Configuration::get('GOFPAY_GATEWAY_VERSION') . '/gateway';
    if ($useSSL) {
        //crul请求,
        $info = curl_post($gofpay_gateway_url, http_build_query($fomrs, '', '&'));
    } else {
        //普通http请求
        $info = http_post($gofpay_gateway_url, http_build_query($fomrs, '', '&'));
    }
    return explode_return_str($info);
}
开发者ID:gofpay,项目名称:prestashop-common,代码行数:17,代码来源:transaction.php

示例10: http_post_serialized

function http_post_serialized($host, $path, $in, &$out)
{
    // serialize
    $in = serialize($in);
    // setup headers
    $headers = array("Content-Type" => "application/vnc.php.serialized");
    // call http_post
    $status = http_post($host, $path, $headers, $in, $headers, $out);
    // unserialize
    $out = @unserialize($out);
    // return
    return $status;
}
开发者ID:jenalgit,项目名称:atsumi,代码行数:13,代码来源:http.php

示例11: test

 function test()
 {
     $param['touser'] = "o3ZYauOnS_g-qQ9bYISisG2MLfvE";
     $param['msgtype'] = "text";
     $param['text']['content'] = "Hello World!";
     $param['customservice']['kf_account'] = "zbyy@nyfslg";
     $param_json = json_encode($param);
     dump($param_json);
     $token = get_token();
     $access_token = get_access_token($token);
     $url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" . $access_token;
     $return = http_post($url, $param_json);
     dump($return);
 }
开发者ID:strivi,项目名称:siples,代码行数:14,代码来源:SendredpackController.class.php

示例12: send_ewm

 function send_ewm()
 {
     //-----获取access_token
     $access_token = get_access_token();
     //----生成二维码
     $ewmid = I('ewmid');
     $postUrl = 'https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=' . $access_token;
     $postJson = '{"action_name": "QR_LIMIT_SCENE", "action_info": {"scene": {"scene_id": ' . $ewmid . '}}}';
     $return = json_decode(http_post($postUrl, $postJson), true);
     if ($return['errcode'] == 0) {
         $ticket = $return['ticket'];
         $qr_code = 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . UrlEncode($ticket);
         $this->qr_code_save($qr_code, $ewmid);
         $this->success('生成二维码成功');
     } else {
         $this->error('生成二维码失败,错误的返回码是:' . $res['errcode'] . ', 错误的提示是:' . $res['errmsg']);
     }
 }
开发者ID:strivi,项目名称:siples,代码行数:18,代码来源:QrcodeController.class.php

示例13: get_taobao_session_keyOp

 public function get_taobao_session_keyOp()
 {
     $taobao_session_key = "";
     if (C('taobao_api_isuse')) {
         $param = array();
         $param['client_id'] = C('taobao_app_key');
         $param['client_secret'] = C('taobao_secret_key');
         $param['grant_type'] = 'authorization_code';
         $param['code'] = trim($_POST['auth_code']);
         $param['redirect_uri'] = "urn:ietf:wg:oauth:2.0:oob";
         $result = http_post('https://oauth.taobao.com/token', $param);
         if ($result) {
             $result = json_decode($result);
             if (!empty($result->access_token)) {
                 $taobao_session_key = $result->access_token;
             }
         }
     }
     output_data(array('taobao_session_key' => $taobao_session_key));
 }
开发者ID:noikiy,项目名称:meizhan,代码行数:20,代码来源:seller_taobao_api.php

示例14: foursquare_api_call

function foursquare_api_call($method, $args = array(), $more = array())
{
    $method = ltrim($method, "/");
    $args['v'] = gmdate("Ymd", time());
    if ($more['method'] == 'POST') {
        $url = $GLOBALS['foursquare_api_endpoint'] . $method;
        $rsp = http_post($url, $args);
    } else {
        $query = http_build_query($args);
        $url = $GLOBALS['foursquare_api_endpoint'] . $method . "?{$query}";
        $rsp = http_get($url);
    }
    if (!$rsp['ok']) {
        return $rsp;
    }
    $data = json_decode($rsp['body'], "as hash");
    if (!$data) {
        return not_okay("failed to parse response");
    }
    return okay(array("rsp" => $data['response']));
}
开发者ID:nilswalk,项目名称:privatesquare,代码行数:21,代码来源:lib_foursquare_api.php

示例15: search_post

function search_post($es, $db, $idx, $q)
{
    $q = str_replace("=", ":", $q);
    $url = $es . '/' . $db . '/' . $idx . '/_search';
    $doc = array("query" => array("query_string" => array("query" => $q)), "size" => 9999);
    $r = http_post($url, $doc);
    $arr = array();
    $ids = [];
    foreach ($r->hits->hits as $hit) {
        $doc = $hit->_source;
        if (isset($doc->id) && !isset($doc->_id)) {
            $doc->_id = $doc->id;
            unset($doc->id);
        }
        if (isset($doc->rev) && !isset($doc->_rev)) {
            $doc->_rev = $doc->rev;
            unset($doc->rev);
        }
        $arr[] = $doc;
    }
    return $arr;
}
开发者ID:CNCFlora,项目名称:sig,代码行数:22,代码来源:http.php


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