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


PHP post_data函数代码示例

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


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

示例1: _thumb_media_id

 function _thumb_media_id($cover_id)
 {
     $cover = get_cover($cover_id);
     $driver = C('PICTURE_UPLOAD_DRIVER');
     if ($driver != 'Local' && !file_exists(SITE_PATH . $cover['path'])) {
         // 先把图片下载到本地
         $pathinfo = pathinfo(SITE_PATH . $cover['path']);
         mkdirs($pathinfo['dirname']);
         $content = wp_file_get_contents($cover['url']);
         $res = file_put_contents(SITE_PATH . $cover['path'], $content);
         if ($res) {
             return '';
         }
     }
     $path = $cover['path'];
     if (!$path) {
         return '';
     }
     $param['type'] = 'thumb';
     $param['media'] = '@' . realpath(SITE_PATH . $path);
     $url = 'https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=' . get_access_token();
     $res = post_data($url, $param, true);
     if (isset($res['errcode']) && $res['errcode'] != 0) {
         return '';
     }
     $map['cover_id'] = $cover_id;
     $map['manager_id'] = $this->mid;
     $this->where($map)->setField('thumb_media_id', $res['media_id']);
     return $res['media_id'];
 }
开发者ID:walkingmanc,项目名称:weshop,代码行数:30,代码来源:MaterialModel.class.php

示例2: get_token

/**
 * get_token	gets an edit token
 *
 * @return	string	edit token
 */
function get_token()
{
    $postdata = http_build_query(array('action' => 'tokens', 'format' => 'json'));
    $page = post_data($postdata);
    $token = $page->{'tokens'}->{'edittoken'};
    return $token;
}
开发者ID:Atlasmuseum,项目名称:AM,代码行数:12,代码来源:API_CommonFunctions.php

示例3: getDomainInfo

function getDomainInfo()
{
    $url = 'https://dnsapi.cn/Domain.List';
    $config = array('login_email' => 'ulpyuxa@163.com', 'login_password' => 'pdcxaje127', 'format' => 'json', 'lang' => 'cn', 'error_on_empty' => 'no');
    $post_data = post_data($url, $config);
    return json_decode($post_data, true);
}
开发者ID:ulpyuxa,项目名称:wishorder.wishtool.com,代码行数:7,代码来源:pi_ddns.php

示例4: move_group

 function move_group($id, $group_id)
 {
     is_array($id) || ($id = explode(',', $id));
     $data['uid'] = $map['uid'] = array('in', $id);
     // $data ['group_id'] = $group_id; //TODO 前端微信用户只能有一个微信组
     $res = M('auth_group_access')->where($data)->delete();
     $data['group_id'] = $group_id;
     foreach ($id as $uid) {
         $data['uid'] = $uid;
         $res = M('auth_group_access')->add($data);
         // 更新用户缓存
         D('Common/User')->getUserInfo($uid, true);
     }
     $group = $this->find($group_id);
     // 同步到微信端
     if (C('USER_GROUP') && !empty($group['wechat_group_id'])) {
         $url = 'https://api.weixin.qq.com/cgi-bin/groups/members/update?access_token=' . get_access_token();
         $map['token'] = get_token();
         $follow = M('public_follow')->where($map)->field('openid, uid')->select();
         foreach ($follow as $v) {
             if (empty($v['openid'])) {
                 continue;
             }
             $param['openid'] = $v['openid'];
             $param['to_groupid'] = $group['wechat_group_id'];
             $param = JSON($param);
             $res = post_data($url, $param);
         }
     }
     return $group;
 }
开发者ID:yxz1025,项目名称:weiphp3.0,代码行数:31,代码来源:AuthGroupModel.class.php

示例5: create_notice

/**
 * create_notice
 * 
 * @return	string
 */
function create_notice()
{
    $title = "New Page (" . date("Y-m-d H:i:s") . ")";
    $text = "{{Notice d'œuvre\n|titre= \nartiste= \n}}";
    // Post new content
    $postdata = http_build_query(array('action' => 'edit', 'format' => 'json', 'title' => $title, 'text' => $text, 'token' => get_token()));
    $page = post_data($postdata);
    return $page->{'edit'}->{'pageid'};
    #return 'undefined';
}
开发者ID:Atlasmuseum,项目名称:AM,代码行数:15,代码来源:API_CreateNotice.php

示例6: reply

 function reply($dataArr, $keywordArr = array())
 {
     // addWeixinLog ( $dataArr, 'PublicBindModel' );
     if ($dataArr['Content'] == 'TESTCOMPONENT_MSG_TYPE_TEXT') {
         $this->replyText('TESTCOMPONENT_MSG_TYPE_TEXT_callback');
     } elseif (strpos($dataArr['Content'], 'QUERY_AUTH_CODE') !== false) {
         // addWeixinLog ( $dataArr ['Content'], '222' );
         $query_auth_code = str_replace('QUERY_AUTH_CODE:', '', $dataArr['Content']);
         $info = D('Addons://PublicBind/PublicBind')->getAuthInfo($query_auth_code);
         // addWeixinLog ( $info, '555' );
         $param['touser'] = $dataArr['FromUserName'];
         $param['msgtype'] = 'text';
         $param['text']['content'] = $query_auth_code . '_from_api';
         $url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=' . $info['authorization_info']['authorizer_access_token'];
         // addWeixinLog ( $param, $url );
         $res = post_data($url, $param);
     } else {
         $this->replyText($dataArr['Event'] . 'from_callback');
     }
 }
开发者ID:yxz1025,项目名称:weiphp3.0,代码行数:20,代码来源:WeixinAddonModel.class.php

示例7: htmlspecialchars

<?php

//header('Content-type: application/json');
require './../config.php';
require './../functions.php';
if ($_POST == null) {
    exit;
}
if (post_data('email') != null and post_data('password') == null) {
    $email = htmlspecialchars($_POST['email']);
    $total = count($DB->query("SELECT * FROM user WHERE email=?", array($email)));
    if ($total == 1) {
        $result = array('valid' => 'true');
    } else {
        $result = array('valid' => 'false');
    }
} else {
    $myusername = $_POST['email'];
    $mypassword = $_POST['password'];
    $mypassword = MD5($mypassword . '404notfound');
    $count = count($DB->query("SELECT * FROM user WHERE email=? and pass=?", array($myusername, $mypassword)));
    if ($count == 1) {
        session_start();
        $_SESSION['myusername'] = $myusername;
        $_SESSION['mypassword'] = $mypassword;
        $result['message'] = "success";
        // session_register("mypassword");
        //header("location:userpanel.php");
    } else {
        $result['message'] = "errow";
    }
开发者ID:zhangwen9229,项目名称:404-Not-Found,代码行数:31,代码来源:login.php

示例8: upload_youkang_image

function upload_youkang_image($path, $type = 'image')
{
    $url = 'http://www.youkang120.com:84/uploadAudio?userName=18820475115&pwd=123456&bizType=2';
    $param['type'] = $type;
    $param['media'] = '@' . realpath($path);
    $end = '\\r\\n';
    $twoHyphens = '--';
    $boundary = '************';
    $header[] = 'Content-Type: multipart/form-data;boundary=' . $boundary;
    $res = post_data($url, $param, true);
    if (isset($res['errcode']) && $res['errcode'] != 0) {
        $this->error(error_msg($res, '图片上传'));
        exit;
    }
    $content = $twoHyphens . $boundary;
    $content = $end;
    $content = 'Content-Disposition: form-data; ' . 'name="file1";filename="image.jpg"';
    $content = $end;
    $content = $end;
    //file
    $twoHyphens . $boundary . $twoHyphens;
    $end;
    return $res['media_id'];
}
开发者ID:kevinstudio,项目名称:zaodianla,代码行数:24,代码来源:wx_sample.php

示例9: _get_file_media_id

 function _get_file_media_id($file_id, $type = 'voice', $title = '', $introduction = '')
 {
     $fileInfo = M('file')->find($file_id);
     if ($fileInfo) {
         $path = '/Uploads/Download/' . $fileInfo['savepath'] . $fileInfo['savename'];
         if (!$path) {
             $this->error('获取素材失败');
             exit;
         }
         $param['type'] = $type;
         $param['media'] = '@' . realpath(SITE_PATH . $path);
         if ($type == 'video') {
             $param['description']['title'] = $title;
             $param['description']['introduction'] = $introduction;
         }
         $url = 'https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=' . get_access_token();
         $res = post_data($url, $param);
         if (!$res) {
             $this->error('同步失败');
         }
         if (isset($res['errcode']) && $res['errcode'] != 0) {
             $this->error(error_msg($res, '素材上传'));
             exit;
         }
     }
     return $res['media_id'];
 }
开发者ID:yxz1025,项目名称:weiphp3.0,代码行数:27,代码来源:MaterialController.class.php

示例10: getPublicInfo

 function getPublicInfo($authorizer_appid)
 {
     $res['status'] = false;
     $component_access_token = $this->_get_component_access_token();
     if ($component_access_token == false) {
         $res['msg'] = '获取access_token失败!';
         return $res;
     }
     $key = 'getPublicInfo_' . $authorizer_appid;
     $data = S($key);
     if ($data === false) {
         $url = 'https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_info?component_access_token=' . $component_access_token;
         $param['component_appid'] = $this->component_appid;
         $param['authorizer_appid'] = $authorizer_appid;
         $data = post_data($url, $param);
         if (!isset($data['authorizer_info']['user_name'])) {
             $res['msg'] = '获取公众号信息失败!';
             return $res;
         }
         S($key, $data, $data['expires_in']);
     }
     return $data;
 }
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:23,代码来源:PublicBindModel.class.php

示例11: array

<?php

$appKey = '123456';
$appSecret = '123456';
$mobileNumber = '13578888888';
$amount = '10';
$url = 'http://121.40.104.167:8080/charge/mobilefee';
$param = array('appKey' => $appKey, 'mobileNumber' => $mobileNumber, 'amount' => $amount, 'verify' => md5($appKey . $mobileNumber . $amount . $appSecret));
function post_data($url, $param)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($param));
    // curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:8888');
    // curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0);
    // receive server response ...
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $server_output = curl_exec($ch);
    curl_close($ch);
    return $server_output;
}
$res = post_data($url, $param);
var_dump(json_decode($res));
开发者ID:flydement,项目名称:MyTest,代码行数:24,代码来源:demo.php

示例12: _video_download

 function _video_download($media_id, $cover_url)
 {
     $savePath = SITE_PATH . '/Uploads/Download/' . time_format(NOW_TIME, 'Y-m-d');
     mkdirs($savePath);
     $ext = 'mp4';
     if (empty($cover_url)) {
         // 获取图片URL
         $url = 'https://api.weixin.qq.com/cgi-bin/material/get_material?access_token=' . get_access_token();
         $param['media_id'] = $media_id;
         $info = post_data($url, $param);
         if (isset($info['errcode']) && $info['errcode'] != 0) {
             $this->error(error_msg($info, '下载视频文件素材失败'));
             exit;
         }
         return $info;
     } else {
         $content = wp_file_get_contents($cover_url);
         // 获取图片扩展名
         $picExt = substr($cover_url, strrpos($cover_url, '=') + 1);
         // $picExt=='jpeg'
         if (empty($picExt)) {
             $picExt = $ext;
         }
         $picName = NOW_TIME . '.' . $picExt;
         $picPath = $savePath . '/' . $picName;
         $res = file_put_contents($picPath, $content);
         if (!$res) {
             $this->error('远程视频文件下载失败');
             exit;
         }
     }
     $cover_id = 0;
     if ($res) {
         // 保存记录,添加到picture表里,获取coverid
         $url = U('File/uploadPicture', array('session_id' => session_id()));
         $_FILES['download'] = array('name' => $picName, 'type' => 'application/octet-stream', 'tmp_name' => $picPath, 'size' => $res, 'error' => 0);
         $File = D('File');
         $file_driver = C('DOWNLOAD_UPLOAD_DRIVER');
         $info = $File->upload($_FILES, C('DOWNLOAD_UPLOAD'), C('DOWNLOAD_UPLOAD_DRIVER'), C("UPLOAD_{$file_driver}_CONFIG"));
         $cover_id = $info['download']['id'];
         unlink($picPath);
     }
     return $cover_id;
 }
开发者ID:PunkAvail,项目名称:ThinkWechat,代码行数:44,代码来源:MaterialController.class.php

示例13: tongbu_follow

 function tongbu_follow()
 {
     $map['manager_id'] = $this->mid;
     $map['token'] = get_token();
     $list = M('auth_group')->where($map)->select();
     foreach ($list as $v) {
         $arr[$v['id']] = $v['wechat_group_id'];
     }
     $id = I('id', 0, 'intval');
     $map['id'] = array('gt', $id);
     $map['has_subscribe'] = 1;
     $map['token'] = get_token();
     $follow_list = M('public_follow')->where($map)->order('id asc')->limit(5)->select();
     if (!$follow_list) {
         echo 'update over!';
         exit;
     }
     $access_token = get_access_token();
     $url = 'https://api.weixin.qq.com/cgi-bin/groups/members/update?access_token=' . $access_token;
     foreach ($follow_list as $follow) {
         $param['openid'] = $follow['openid'];
         $param['to_groupid'] = intval($arr[$follow['group']]);
         $param = JSON($param);
         $res = post_data($url, $param);
         $has_subscribe = $res['errcode'] == 43004 ? 0 : 1;
         M('public_follow')->where('id=' . $follow['id'])->setField('has_subscribe', $has_subscribe);
     }
     $param2['id'] = $follow['id'];
     $url = U('tongbu_follow', $param2);
     $url = addons_url('tongbu_follow');
     $this->success('同步用户数据中,请勿关闭', $url);
     // echo 'update follow_id: ' . $follow ['id'] . ', please wait!';
     // echo '<script>window.location.href="' . $url . '";</script>';
 }
开发者ID:kevinstudio,项目名称:zaodianla,代码行数:34,代码来源:AuthGroupController.class.php

示例14: GetDescribeSenURL2

}
echo "</div>";
//
if (isset($_POST['descsensor'])) {
    // 2. DescribeSensor
    echo "<h2> The Details of Sensors in SOS </h2>";
    $procedure = $_POST['descsensor'];
    //echo $procedure."<br/>";
    // sample request
    //$dSensorURL = "http://localhost/istsos/service_name?service=SOS&request=describeSensor&procedure=hum_bs_1&responseFormat=text/xml;subtype='sensorML/1.0.0'&version=1.0.0";
    $dSensorURL = GetDescribeSenURL2($DescribeSenStr, $procedure, $RespFormat);
    session_start();
    $dSensorURL = $_SESSION['rawURL'] . $dSensorURL;
    $dSensorstring = "";
    //echo "URL Used / Accessed: ".$dSensorURL."</br>";
    $dSoutput = post_data($dSensorURL, $dSensorstring);
    //print_r($dSoutput);
    // a. Quantity
    $Quantity = array('Quantity', 'definition');
    $myQuantity = parse_describeSense($dSoutput, $Quantity);
    $myCleanQuantity = cleanQuantity($myQuantity);
    //print_r($myCleanQuantity);
    // b. co-ordinates
    $reference = array('Point', 'srsName', 'gml:id');
    $myCoOrd = getCoOrdinates($dSoutput, $reference);
    //echo "</br></br>";
    //print_r($myCoOrd);
    // c. Sensing time Interval
    $reference = 'interval';
    $myInterval = getInterval($dSoutput, $reference);
    //echo "</br></br>";
开发者ID:abhishekvp,项目名称:php_istSOS_client,代码行数:31,代码来源:desc_sensor.php

示例15: get_image_media_id

 function get_image_media_id($cover_id)
 {
     $cover = get_cover($cover_id);
     $driver = C('PICTURE_UPLOAD_DRIVER');
     if ($driver != 'Local' && !file_exists(SITE_PATH . $cover['path'])) {
         // 先把图片下载到本地
         $pathinfo = pathinfo(SITE_PATH . $cover['path']);
         mkdirs($pathinfo['dirname']);
         $content = wp_file_get_contents($cover['url']);
         $res = file_put_contents(SITE_PATH . $cover['path'], $content);
         if (!$res) {
             $this->error('远程图片下载失败');
         }
     }
     $path = $cover['path'];
     if (!$path) {
         $this->error('获取图片素材失败');
     }
     $param['type'] = 'image';
     $param['media'] = '@' . realpath(SITE_PATH . $path);
     $url = 'https://api.weixin.qq.com/cgi-bin/media/upload?access_token=' . get_access_token();
     $res = post_data($url, $param, true);
     if (isset($res['errcode']) && $res['errcode'] != 0) {
         $this->error(error_msg($res, '封面图上传'));
     }
     return $res['media_id'];
 }
开发者ID:LukeChow1018,项目名称:weixin,代码行数:27,代码来源:WeixinMessageController.class.php


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