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


PHP do_post函数代码示例

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


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

示例1: set_log

/**
 * DO SOMETHING AND SEND LOG VIA POST
 * @param array $logData content with details of the log
 */
function set_log(array $logData)
{
    $log_name = $logData['level'] . '_' . $logData['log_name'];
    // PATH TO WHERE API IS HOSTED
    $url = 'http://localhost/logs-notification/Logs/notification';
    return do_post($logData, $url);
}
开发者ID:brnbp,项目名称:logs,代码行数:11,代码来源:index.php

示例2: call_yql

/**
 * Call the Yahoo Contact API
 * @param string $consumer_key obtained when you registered your app
 * @param string $consumer_secret obtained when you registered your app
 * @param string $guid obtained from getacctok
 * @param string $access_token obtained from getacctok
 * @param string $access_token_secret obtained from getacctok
 * @param bool $usePost use HTTP POST instead of GET
 * @param bool $passOAuthInHeader pass the OAuth credentials in HTTP header
 * @return response string with token or empty array on error
 */
function call_yql($consumer_key, $consumer_secret, $querynum, $access_token, $access_token_secret, $usePost = false, $passOAuthInHeader = true)
{
    $retarr = array();
    // return value
    $response = array();
    if ($querynum == 1) {
        $url = 'http://query.yahooapis.com/v1/yql';
        // Show my profile
        $params['q'] = 'select * from social.profile where guid=me';
    } elseif ($querynum == 2) {
        $url = 'http://query.yahooapis.com/v1/yql';
        // Find my friends
        $params['q'] = 'select * from social.connections where owner_guid=me';
    } else {
        // Since this information is public, use the non oauth endpoint 'public'
        $url = 'http://query.yahooapis.com/v1/public/yql';
        // Find all sushi restaurants in SF order by number of ratings desc
        $params['q'] = 'select Title,Address,Rating from local.search where query="sushi" and location="san francisco, ca"|sort(field="Rating.TotalRatings",descending="true")';
    }
    $params['format'] = 'json';
    $params['callback'] = 'cbfunc';
    $params['oauth_version'] = '1.0';
    $params['oauth_nonce'] = mt_rand();
    $params['oauth_timestamp'] = time();
    $params['oauth_consumer_key'] = $consumer_key;
    $params['oauth_token'] = $access_token;
    // compute hmac-sha1 signature and add it to the params list
    $params['oauth_signature_method'] = 'HMAC-SHA1';
    $params['oauth_signature'] = oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $url, $params, $consumer_secret, $access_token_secret);
    // Pass OAuth credentials in a separate header or in the query string
    if ($passOAuthInHeader) {
        $query_parameter_string = oauth_http_build_query($params, true);
        $header = build_oauth_header($params, "yahooapis.com");
        $headers[] = $header;
    } else {
        $query_parameter_string = oauth_http_build_query($params);
    }
    // POST or GET the request
    if ($usePost) {
        $request_url = $url;
        logit("call_yql:INFO:request_url:{$request_url}");
        logit("call_yql:INFO:post_body:{$query_parameter_string}");
        $headers[] = 'Content-Type: application/x-www-form-urlencoded';
        $response = do_post($request_url, $query_parameter_string, 80, $headers);
    } else {
        $request_url = $url . ($query_parameter_string ? '?' . $query_parameter_string : '');
        logit("call_yql:INFO:request_url:{$request_url}");
        $response = do_get($request_url, 80, $headers);
    }
    // extract successful response
    if (!empty($response)) {
        list($info, $header, $body) = $response;
        if ($body) {
            logit("call_yql:INFO:response:");
            print json_pretty_print($body);
        }
        $retarr = $response;
    }
    return $retarr;
}
开发者ID:S-Berhane,项目名称:oauth_yahoo,代码行数:71,代码来源:yql.php

示例3: add_blog

function add_blog()
{
    //发表QQ空间日志的接口地址, 不要更改!!
    $url = "https://graph.qq.com/blog/add_one_blog";
    $data = "access_token=" . $_SESSION["access_token"] . "&oauth_consumer_key=" . $_SESSION["appid"] . "&openid=" . $_SESSION["openid"] . "&format=" . $_POST["format"] . "&title=" . $_POST["title"] . "&content=" . $_POST["content"];
    $ret = do_post($url, $data);
    return $ret;
}
开发者ID:caotieshuan,项目名称:ishoutou,代码行数:8,代码来源:add_blog.php

示例4: add_album

function add_album()
{
    //创建QQ空间相册的接口地址, 不要更改!!
    $url = "https://graph.qq.com/photo/add_album";
    $data = "access_token=" . $_SESSION["access_token"] . "&oauth_consumer_key=" . $_SESSION["appid"] . "&openid=" . $_SESSION["openid"] . "&format=" . $_POST["format"] . "&albumname=" . urlencode($_POST["albumname"]) . "&albumdesc=" . urlencode($_POST["albumdesc"]) . "&priv=" . $_POST["priv"];
    //echo $data;
    $ret = do_post($url, $data);
    return $ret;
}
开发者ID:caotieshuan,项目名称:ishoutou,代码行数:9,代码来源:add_album.php

示例5: add_weibo

function add_weibo()
{
    //发表微博的接口地址, 不要更改!!
    $url = "https://graph.qq.com/wb/add_weibo";
    $data = "access_token=" . $_SESSION["access_token"] . "&oauth_consumer_key=" . $_SESSION["appid"] . "&openid=" . $_SESSION["openid"] . "&format=" . $_POST["format"] . "&type=" . $_POST["type"] . "&content=" . urlencode($_POST["content"]) . "&img=" . urlencode($_POST["img"]);
    //echo $data;
    $ret = do_post($url, $data);
    return $ret;
}
开发者ID:caotieshuan,项目名称:ishoutou,代码行数:9,代码来源:add_weibo.php

示例6: add_topic

function add_topic()
{
    //发表QQ空间日志的接口地址, 不要更改!!
    $url = "https://graph.qq.com/shuoshuo/add_topic";
    $data = "access_token=" . $_SESSION["access_token"] . "&oauth_consumer_key=" . $_SESSION["appid"] . "&openid=" . $_SESSION["openid"] . "&format=" . $_POST["format"] . "&richtype=" . $_POST["richtype"] . "&richval=" . urlencode($_POST["richval"]) . "&con=" . urlencode($_POST["con"]) . "&lbs_nm=" . $_POST["lbs_nm"] . "&lbs_x=" . $_POST["lbs_x"] . "&lbs_y=" . $_POST["lbs_y"] . "&third_source=" . $_POST["third_source"];
    //echo $data;
    $ret = do_post($url, $data);
    return $ret;
}
开发者ID:caotieshuan,项目名称:ishoutou,代码行数:9,代码来源:add_topic.php

示例7: callcontact

/**
 * Call the Yahoo Contact API
 * @param string $consumer_key obtained when you registered your app
 * @param string $consumer_secret obtained when you registered your app
 * @param string $guid obtained from getacctok
 * @param string $access_token obtained from getacctok
 * @param string $access_token_secret obtained from getacctok
 * @param bool $usePost use HTTP POST instead of GET
 * @param bool $passOAuthInHeader pass the OAuth credentials in HTTP header
 * @return response string with token or empty array on error
 */
function callcontact($consumer_key, $consumer_secret, $guid, $access_token, $access_token_secret, $usePost = false, $passOAuthInHeader = true, $_count)
{
    $retarr = array();
    // return value
    $response = array();
    $url = 'http://social.yahooapis.com/v1/user/' . $guid . '/contacts?count=' . $_count;
    $params['format'] = 'xml';
    $params['view'] = 'compact';
    $params['oauth_version'] = '1.0';
    $params['oauth_nonce'] = mt_rand();
    $params['oauth_timestamp'] = time();
    $params['oauth_consumer_key'] = $consumer_key;
    $params['oauth_token'] = $access_token;
    // compute hmac-sha1 signature and add it to the params list
    $params['oauth_signature_method'] = 'HMAC-SHA1';
    //$params['oauth_signature'] =
    // oauth_compute_hmac_sig($usePost? 'POST' : 'GET', $url, $params,
    // $consumer_secret, $access_token_secret);
    echo ',';
    echo $params['oauth_nonce'];
    echo ',';
    echo $params['oauth_timestamp'];
    echo ',';
    echo oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $url, $params, $consumer_secret, $access_token_secret);
    exit(0);
    // Pass OAuth credentials in a separate header or in the query string
    if ($passOAuthInHeader) {
        $query_parameter_string = oauth_http_build_query($params, true);
        $header = build_oauth_header($params, "yahooapis.com");
        $headers[] = $header;
    } else {
        $query_parameter_string = oauth_http_build_query($params);
    }
    // POST or GET the request
    if ($usePost && 0) {
        $request_url = $url;
        logit("callcontact:INFO:request_url:{$request_url}");
        logit("callcontact:INFO:post_body:{$query_parameter_string}");
        $headers[] = 'Content-Type: application/x-www-form-urlencoded';
        $response = do_post($request_url, $query_parameter_string, 80, $headers);
    } else {
        $request_url = $url . ($query_parameter_string ? '?' . $query_parameter_string : '');
        logit("callcontact:INFO:request_url:{$request_url}");
        $response = do_get($request_url, 80, $headers);
    }
    // extract successful response
    if (!empty($response)) {
        list($info, $header, $body) = $response;
        if ($body) {
            logit("callcontact:INFO:response:");
            print json_pretty_print($body);
        }
        $retarr = $response;
    }
    return $retarr;
}
开发者ID:nitishpandey,项目名称:semiprecious,代码行数:67,代码来源:callcontact.php

示例8: refresh_access_token

/**
 * Refresh an access token using an expired request token
 * @param string $consumer_key obtained when you registered your app
 * @param string $consumer_secret obtained when you registered your app
 * @param string $old_access_token obtained previously
 * @param string $old_token_secret obtained previously
 * @param string $oauth_session_handle obtained previously
 * @param bool $usePost use HTTP POST instead of GET (default false)
 * @param bool $useHmacSha1Sig use HMAC-SHA1 signature (default false)
 * @return response string with token or empty array on error
 */
function refresh_access_token($consumer_key, $consumer_secret, $old_access_token, $old_token_secret, $oauth_session_handle, $usePost = false, $useHmacSha1Sig = true, $passOAuthInHeader = true)
{
    $retarr = array();
    // return value
    $response = array();
    $url = 'https://api.login.yahoo.com/oauth/v2/get_token';
    $params['oauth_version'] = '1.0';
    $params['oauth_nonce'] = mt_rand();
    $params['oauth_timestamp'] = time();
    $params['oauth_consumer_key'] = $consumer_key;
    $params['oauth_token'] = $old_access_token;
    $params['oauth_session_handle'] = $oauth_session_handle;
    // compute signature and add it to the params list
    if ($useHmacSha1Sig) {
        $params['oauth_signature_method'] = 'HMAC-SHA1';
        $params['oauth_signature'] = oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $url, $params, $consumer_secret, $old_token_secret);
    } else {
        $params['oauth_signature_method'] = 'PLAINTEXT';
        $params['oauth_signature'] = oauth_compute_plaintext_sig($consumer_secret, $old_token_secret);
    }
    // Pass OAuth credentials in a separate header or in the query string
    if ($passOAuthInHeader) {
        $query_parameter_string = oauth_http_build_query($params, true);
        $header = build_oauth_header($params, "yahooapis.com");
        $headers[] = $header;
    } else {
        $query_parameter_string = oauth_http_build_query($params);
    }
    // POST or GET the request
    if ($usePost) {
        $request_url = $url;
        logit("refacctok:INFO:request_url:{$request_url}");
        logit("refacctok:INFO:post_body:{$query_parameter_string}");
        $headers[] = 'Content-Type: application/x-www-form-urlencoded';
        $response = do_post($request_url, $query_parameter_string, 443, $headers);
    } else {
        $request_url = $url . ($query_parameter_string ? '?' . $query_parameter_string : '');
        logit("refacctok:INFO:request_url:{$request_url}");
        $response = do_get($request_url, 443, $headers);
    }
    // extract successful response
    if (!empty($response)) {
        list($info, $header, $body) = $response;
        $body_parsed = oauth_parse_str($body);
        if (!empty($body_parsed)) {
            logit("getacctok:INFO:response_body_parsed:");
            print_r($body_parsed);
        }
        $retarr = $response;
        $retarr[] = $body_parsed;
    }
    return $retarr;
}
开发者ID:nitishpandey,项目名称:semiprecious,代码行数:64,代码来源:refacctok.php

示例9: get_request_token

 function get_request_token($callback = 'oob', $usePost = false, $useHmacSha1Sig = true, $passOAuthInHeader = false)
 {
     $retarr = array();
     // return value
     $response = array();
     $params['oauth_version'] = '1.0';
     $params['oauth_nonce'] = mt_rand();
     $params['oauth_timestamp'] = time();
     $params['oauth_consumer_key'] = $this->consumer_key;
     $params['oauth_callback'] = $callback;
     $headers = array();
     // compute signature and add it to the params list
     if ($useHmacSha1Sig) {
         $params['oauth_signature_method'] = 'HMAC-SHA1';
         $params['oauth_signature'] = oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $this->reqUrl, $params, $this->consumer_secret, null);
     } else {
         $params['oauth_signature_method'] = 'PLAINTEXT';
         $params['oauth_signature'] = oauth_compute_plaintext_sig($this->consumer_secret, null);
     }
     // Pass OAuth credentials in a separate header or in the query string
     if ($passOAuthInHeader) {
         $query_parameter_string = oauth_http_build_query($params, true);
         $header = build_oauth_header($params, "Twitter API");
         $headers[] = $header;
     } else {
         $query_parameter_string = oauth_http_build_query($params);
     }
     // POST or GET the request
     if ($usePost) {
         $request_url = $this->reqUrl;
         logit("getreqtok:INFO:request_url:{$request_url}");
         logit("getreqtok:INFO:post_body:{$query_parameter_string}");
         $headers[] = 'Content-Type: application/x-www-form-urlencoded';
         $response = do_post($request_url, $query_parameter_string, 80, $headers);
     } else {
         $request_url = $this->reqUrl . ($query_parameter_string ? '?' . $query_parameter_string : '');
         logit("getreqtok:INFO:request_url:{$request_url}");
         $response = do_get($request_url, 80, $headers);
     }
     // extract successful response
     if (!empty($response)) {
         list($info, $header, $body) = $response;
         $body_parsed = oauth_parse_str($body);
         if (!empty($body_parsed)) {
             logit("getreqtok:INFO:response_body_parsed:");
         }
         $retarr = $response;
         $retarr[] = $body_parsed;
     }
     return $retarr;
 }
开发者ID:adadsa,项目名称:sosmed,代码行数:51,代码来源:library_helper.php

示例10: post_tweet

/**
* Call twitter to post a tweet
* @param string $consumer_key obtained when you registered your app
* @param string $consumer_secret obtained when you registered your app
* @param string $status_message
* @param string $access_token obtained from get_request_token
* @param string $access_token_secret obtained from get_request_token
* @param bool $usePost use HTTP POST instead of GET
* @param bool $passOAuthInHeader pass OAuth credentials in HTTP header
* @return response string or empty array on error
*/
function post_tweet($consumer_key, $consumer_secret, $status_message, $access_token, $access_token_secret, $usePost = false, $passOAuthInHeader = true)
{
    $retarr = array();
    // return value
    $response = array();
    //$url = 'http://api.twitter.com/1/statuses/update.json';
    $url = 'http://api.twitter.com/1.1/friendships/incoming.json';
    //$params['status'] = $status_message;
    $params['oauth_version'] = '1.0';
    $params['oauth_nonce'] = mt_rand();
    $params['oauth_timestamp'] = time();
    $params['oauth_consumer_key'] = $consumer_key;
    $params['oauth_token'] = $access_token;
    // compute hmac-sha1 signature and add it to the params list
    $params['oauth_signature_method'] = 'HMAC-SHA1';
    $params['oauth_signature'] = oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $url, $params, $consumer_secret, $access_token_secret);
    // Pass OAuth credentials in a separate header or in the query string
    if ($passOAuthInHeader) {
        $query_parameter_string = oauth_http_build_query($params, true);
        $header = build_oauth_header($params, "Twitter API");
        $headers[] = $header;
    } else {
        $query_parameter_string = oauth_http_build_query($params);
    }
    // POST or GET the request
    if ($usePost) {
        $request_url = $url;
        logit("tweet:INFO:request_url:{$request_url}");
        logit("tweet:INFO:post_body:{$query_parameter_string}");
        $headers[] = 'Content-Type: application/x-www-form-urlencoded';
        $response = do_post($request_url, $query_parameter_string, 80, $headers);
    } else {
        $request_url = $url . ($query_parameter_string ? '?' . $query_parameter_string : '');
        logit("tweet:INFO:request_url:{$request_url}");
        $response = do_get($request_url, 80, $headers);
    }
    // extract successful response
    if (!empty($response)) {
        list($info, $header, $body) = $response;
        if ($body) {
            logit("tweet:INFO:response:");
            print json_pretty_print($body);
        }
        $retarr = $response;
    }
    return $retarr;
}
开发者ID:0x27,项目名称:mrw-code,代码行数:58,代码来源:getfollowrequests.php

示例11: postcontact

/**
 * Call the Yahoo Contact API
 * @param string $consumer_key obtained when you registered your app
 * @param string $consumer_secret obtained when you registered your app
 * @param string $guid obtained from getacctok
 * @param string $access_token obtained from getacctok
 * @param string $access_token_secret obtained from getacctok
 * @param bool $usePost use HTTP POST instead of GET
 * @param bool $passOAuthInHeader pass the OAuth credentials in HTTP header
 * @return response string with token or empty array on error
 */
function postcontact($consumer_key, $consumer_secret, $guid, $access_token, $access_token_secret, $usePost = false, $passOAuthInHeader = true)
{
    $retarr = array();
    // return value
    $response = array();
    $post_body = '{"contact":{"fields":[{"type":"name","value":{"givenName":"John","middleName":"","familyName":"Doe","prefix":"","suffix":"","givenNameSound":"","familyNameSound":""}},{"type":"email","value":"johndoe@example.com"}]}}';
    $url = 'http://social.yahooapis.com/v1/user/' . $guid . '/contacts';
    $params['oauth_version'] = '1.0';
    $params['oauth_nonce'] = mt_rand();
    $params['oauth_timestamp'] = time();
    $params['oauth_consumer_key'] = $consumer_key;
    $params['oauth_token'] = $access_token;
    // compute hmac-sha1 signature and add it to the params list
    $params['oauth_signature_method'] = 'HMAC-SHA1';
    $params['oauth_signature'] = oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $url, $params, $consumer_secret, $access_token_secret);
    // Pass OAuth credentials in a separate header or in the query string
    if ($passOAuthInHeader) {
        $query_parameter_string = oauth_http_build_query($params, true);
        $header = build_oauth_header($params, "yahooapis.com");
        $headers[] = $header;
        $request_url = $url;
    } else {
        $query_parameter_string = oauth_http_build_query($params);
        $request_url = $url . '?' . $query_parameter_string;
    }
    // POST or GET the request
    if ($usePost) {
        logit("postcontact:INFO:request_url:{$request_url}");
        logit("postcontact:INFO:post_body:{$post_body}");
        $headers[] = 'Content-Type: application/json';
        $response = do_post($request_url, $post_body, 80, $headers);
    } else {
        logit("postcontact:INFO:request_url:{$request_url}");
        $response = do_get($request_url, 80, $headers);
    }
    // extract successful response
    if (!empty($response)) {
        list($info, $header, $body) = $response;
        if ($body) {
            logit("postcontact:INFO:response:");
            print json_pretty_print($body);
        }
        $retarr = $response;
    }
    return $retarr;
}
开发者ID:S-Berhane,项目名称:oauth_yahoo,代码行数:57,代码来源:postcontact.php

示例12: init

function init()
{
    myconnect();
    # get
    global $pdf_file;
    $pdf_file = get_get('pdf');
    # lock
    global $db;
    global $lock;
    $sql = "SELECT * FROM zamky WHERE pdf = " . $db->quote($pdf_file) . ";";
    $result = $db->query($sql);
    foreach ($result as $row) {
        $lock = $row;
        break;
    }
    # post
    if (count($_POST) > 0) {
        do_post();
        redir_to_get();
    }
    return true;
}
开发者ID:nimral,项目名称:opraf,代码行数:22,代码来源:opraf.php

示例13: yim_create_session

function yim_create_session()
{
    $oauth_data = $_SESSION['oauth_data'];
    $oauth_token = $oauth_data['oauth_token'];
    $access_token_secret = $oauth_data['oauth_token_secret'];
    $url = 'http://developer.messenger.yahooapis.com/v1/session';
    $params = yim_get_basic_oauth_params();
    $params['fieldsBuddyList'] = '+groups';
    $params['oauth_token'] = $oauth_token;
    $params['oauth_signature'] = oauth_compute_plaintext_sig(OAUTH_CONSUMER_SECRET, $access_token_secret);
    $query_param_string = oauth_http_build_query($params);
    $url = $url . '?' . $query_param_string;
    $headers = array();
    $headers[] = 'Content-Type: application/json;charset=utf-8';
    $response = do_post($url, '{}', 80, $headers);
    yim_fail_if_not_ok($response, 'Could not create session');
    $json_session_data = $response[2];
    $json_handler = new JSON_obj();
    $data = $json_handler->decode($json_session_data);
    $_SESSION['session_data'] = $data;
    return $data;
}
开发者ID:kontinuity,项目名称:ajaxim-yahoo-plugin,代码行数:22,代码来源:yim.php

示例14: upload_pic

function upload_pic()
{
    //上传照片的接口地址, 不要更改!!
    $url = "https://graph.qq.com/photo/upload_pic";
    $params["access_token"] = $_SESSION["access_token"];
    $params["oauth_consumer_key"] = $_SESSION["appid"];
    $params["openid"] = $_SESSION["openid"];
    $params["photodesc"] = urlencode($_POST["photodesc"]);
    $params["title"] = urlencode($_POST["title"]);
    $params["albumid"] = urlencode($_POST["albumid"]);
    $params["x"] = $_POST["x"];
    $params["y"] = $_POST["y"];
    $params["format"] = $_POST["format"];
    //处理上传图片
    foreach ($_FILES as $filename => $filevalue) {
        $tmpfile = dirname($filevalue["tmp_name"]) . "/" . $filevalue["name"];
        move_uploaded_file($filevalue["tmp_name"], $tmpfile);
        $params[$filename] = "@{$tmpfile}";
    }
    $ret = do_post($url, $params);
    unlink($tmpfile);
    //echo $tmpfile;
    return $ret;
}
开发者ID:caotieshuan,项目名称:ishoutou,代码行数:24,代码来源:upload_pic.php

示例15: add_feeds

/**
 * @brief 发布一条动态(feeds)到QQ空间中,展现给好友.请求需经过URL编码,编码时请遵循 RFC 1738
 *
 * @param $appid
 * @param $appkey
 * @param $access_token
 * @param $access_token_secret
 * @param $openid
 */
function add_feeds($appid, $appkey, $access_token, $access_token_secret, $openid)
{
    //发布一条动态的接口地址, 不要更改!!
    $url = "http://openapi.qzone.qq.com/share/add_share";
    echo do_post($url, $appid, $appkey, $access_token, $access_token_secret, $openid);
}
开发者ID:184609680,项目名称:wcy_O2O_95180,代码行数:15,代码来源:add_share.php


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