本文整理汇总了PHP中curl::addRequestData方法的典型用法代码示例。如果您正苦于以下问题:PHP curl::addRequestData方法的具体用法?PHP curl::addRequestData怎么用?PHP curl::addRequestData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类curl
的用法示例。
在下文中一共展示了curl::addRequestData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
public function send($data)
{
global $gGlobalConfig;
include_once ROOT_PATH . 'lib/class/curl.class.php';
$curl = new curl($gGlobalConfig['App_vote']['host'], $gGlobalConfig['App_vote']['dir']);
$curl->setSubmitType('post');
foreach ($data as $k => $v) {
if ($v['order_id'] == '0') {
$curl->addRequestData('title', $v['value']);
$curl->addRequestData('vote_question_id', $gGlobalConfig['des']['0']);
$curl->addRequestData('id', $v['id']);
//record_person 的id
foreach ($data as $key => $value) {
if ($value['type'] == 'file') {
$sql = 'select * from ' . DB_PREFIX . 'materials where id = ' . $value['value'];
$pic = $this->db->fetch_all($sql);
$pic = $pic['0'];
$indexpic = array('host' => $pic['host'], 'dir' => $pic['dir'], 'filepath' => $pic['material_path'], 'filename' => $pic['pic_name']);
}
}
$curl->addRequestData('pictures_info', serialize($indexpic));
$curl->addRequestData('a', vote_option);
$ret = $curl->request('vote_option.php');
if ($ret) {
$sql = 'update ' . DB_PREFIX . 'record_person set stat = 1 where id=' . $v['id'];
$this->db->query($sql);
}
}
}
}
示例2: __destruct
}
public function __destruct()
{
parent::__destruct();
}
public function convert()
{
global $gGlobalConfig;
include_once ROOT_PATH . 'lib/class/curl.class.php';
if ($gGlobalConfig['App_officeconvert']) {
$curl = new curl($gGlobalConfig['App_officeconvert']['host'], $gGlobalConfig['App_officeconvert']['dir']);
}
$curl->setSubmitType('post');
$curl->setReturnFormat('json');
$curl->initPostData();
$curl->addRequestData('custom_appid', CUSTOM_APPID);
$curl->addRequestData('custom_appkey', CUSTOM_APPKEY);
$curl->addFile($_FILES);
$result = $curl->request('convert.php');
//var_dump($result);exit;
$path = 'cache/word/zip_' . uniqid() . '/';
$zipDir = ROOT_PATH . $path;
$return = array();
if (hg_mkdir($zipDir) && is_writeable($zipDir)) {
$zipFile = $zipDir . 'word.zip';
file_put_contents($zipFile, $result);
$unzipDir = $zipDir . 'unzip/';
if (hg_mkdir($unzipDir) && is_writeable($unzipDir)) {
$unzipCmd = ' unzip ' . $zipFile . ' -d ' . realpath($unzipDir);
exec($unzipCmd);
$rmZip = ' rm -f ' . $zipFile;
exec($rmZip);
示例3: __destruct
}
public function __destruct()
{
parent::__destruct();
}
/**
* 转换word文档
*/
public function convert()
{
$app_id = isset($this->input['custom_appid']) ? trim($this->input['custom_appid']) : '';
$app_key = isset($this->input['custom_appkey']) ? trim($this->input['custom_appkey']) : '';
if (empty($app_id) || empty($app_key)) {
$this->errorOutput(PARAM_WRONG);
}
//先验证是否有权限
$auth = new Auth();
$auth_info = $auth->getAccessToken($app_id, $app_key);
if (!$auth_info) {
$this->errorOutput(NO_AUTH);
}
//处理上传的word文档
$gGlobalConfig['officeconvert'] = array('host' => '10.0.1.59:8080', 'dir' => 'officeConverter/');
$curl = new curl($gGlobalConfig['officeconvert']['host'], $gGlobalConfig['officeconvert']['dir']);
$curl->setSubmitType('post');
$curl->setReturnFormat('str');
$curl->initPostData();
$curl->addFile($_FILES);
$curl->addRequestData('custom_appid', $app_id);
$curl->addRequestData('custom_appkey', $app_key);
示例4: video2ftp
public function video2ftp()
{
if (!USE_FTP_UPLOAD) {
return;
}
if (!$this->settings['App_mediaserver']) {
$this->errorOutput('请先安装转码服务器!');
}
$c = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir'] . '/admin/');
$c->initPostData();
$c->addRequestData('video_id', implode(',', array_keys($this->vdata)));
$c->addRequestData('a', 'upload');
foreach ($this->settings['ftp'] as $key => $value) {
$c->addRequestData($key, $value);
}
$re = $c->request('ftp_upload.php');
if (!$re || $re == 'null') {
$this->errorOutput('无效的视频!');
}
if ($re['ErrorCode'] || $re['ErrorText']) {
$this->errorOutput('Mediaserver:' . $re['ErrorText']);
}
foreach ($re as $key => $val) {
if ($val['id']) {
$this->vdata[$val['id']]['ftp_path'] = $val['dir'] . '/';
}
/*
else
{
$this->vdata[$val['id']]['ftp_path'] = $this->vdata[$val['id']]['video_path'];
}
*/
}
}
示例5: setting
public function setting()
{
$data = array('id' => intval($this->user['id']), 'password' => trim($this->input['password']), 'password_again' => trim($this->input['password_again']), 'old_password' => trim($this->input['old_password']));
if ($data['password'] && $data['password'] != $data['password_again']) {
$this->ReportError('两次输入的密码不一样');
}
$curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir']);
$curl->setSubmitType('post');
$curl->setReturnFormat('json');
$curl->initPostData();
$curl->addRequestData('a', 'update_password');
foreach ($data as $key => $val) {
$curl->addRequestData($key, $val);
}
if ($_FILES['Filedata']) {
$curl->addFile($_FILES);
}
$return = $curl->request('member.php');
if ($return && $return[0]) {
if ($return[0]['error'] == -1) {
$this->ReportError('原始密码错误');
}
}
$this->redirect('更新成功');
}
示例6: get_transcode_progress
public function get_transcode_progress()
{
$id = urldecode($this->input['id']);
if (!$id) {
$this->errorOutput("未知的视频");
}
include_once ROOT_PATH . 'lib/class/curl.class.php';
$mediaserver = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir'] . 'admin/');
$ret = array();
$sql = 'SELECT * FROM ' . DB_PREFIX . 'attach where attach_id IN(' . $id . ')';
$query = $this->db->query($sql);
while ($row = $this->db->fetch_array($query)) {
$mediaserver->initPostData();
$mediaserver->addRequestData('id', $row['attach_id']);
$mediaserver->addRequestData('host', $row['host']);
$mediaserver->addRequestData('port', $row['port']);
$mediaserver->addRequestData('a', 'get_transcode_status');
$ret[$row['video']] = $mediaserver->request('video_transcode.php');
}
$output = array();
foreach (explode(',', $id) as $val) {
if (!$ret[$id]) {
$output[$id] = '100';
} else {
$output[$id] = $ret[$id]['return'] == 'success' ? $ret[$id]['transcode_percent'] : "0";
}
}
$this->addItem($output);
$this->output();
}
示例7: send_notify
/**
* 发送消息到用户最后一次登录的设备
* Enter description here ...
*/
public function send_notify()
{
$member_id = intval($this->input['member_id']);
$message = trim($this->input['message']);
$content_id = intval($this->input['content_id']);
$module = trim($this->input['module']);
if (!$member_id) {
$this->errorOutput('NO_MEMBER');
}
if (!$message) {
$this->errorOutput('NO_MESSAGE');
}
$field = 'member_id, last_login_device';
$condition = ' AND member_id=' . $member_id;
$info = $this->mMember->get_member_info($condition, $field, $leftjoin);
if (!$info) {
$this->errorOutput('NO_MEMBER');
}
$last_login_device = $info[0]['last_login_device'];
if (!$last_login_device) {
$this->errorOutput('NO_DEVICE_LOGIN');
}
if ($this->settings['App_push_platform']) {
} else {
$device_len = strlen($last_login_device);
if ($device_len > 60) {
if ($this->settings['App_mobile']) {
$curl = new curl($this->settings['App_mobile']['host'], $this->settings['App_mobile']['dir']);
$curl->initPostData();
$curl->addRequestData('device_token', $last_login_device);
$curl->addRequestData('message', $message);
$curl->addRequestData('module', $module);
$curl->addRequestData('content_id', $content_id);
$ret = $curl->request('send_notify.php');
if ($ret) {
$this->addItem_withkey('result', 1);
} else {
$this->addItem_withkey('result', 0);
}
}
} else {
if ($device_len > 20) {
$curl = new curl($this->settings['App_members']['host'], $this->settings['App_members']['dir']);
$curl->initPostData();
$curl->addRequestData('device_token', $last_login_device);
$curl->addRequestData('message', $message);
$curl->addRequestData('module', $module);
$curl->addRequestData('content_id', $content_id);
$ret = $curl->request('jpush.php');
if ($ret['result']) {
$this->addItem_withkey('result', 1);
} else {
$this->addItem_withkey('result', 0);
}
}
}
}
$this->output();
}
示例8: run
public function run()
{
/**************************************查询出数据库里面正在转码的视频******************************************/
$sql = "SELECT * FROM " . DB_PREFIX . "vodinfo WHERE status = 0 AND vod_leixing != 4 ";
$q = $this->db->query($sql);
$videos = array();
while ($r = $this->db->fetch_array($q)) {
$videos[] = $r['id'];
}
if (!$videos) {
$this->errorOutput(NO_VIDEO_IS_TRANSCODING);
}
/**************************************查询出当前正在开启的服务器********************************************/
$sql = " SELECT * FROM " . DB_PREFIX . "transcode_center WHERE is_open = 1 ";
$q = $this->db->query($sql);
$servers = array();
while ($r = $this->db->fetch_array($q)) {
$servers[] = $r;
}
if (!$servers) {
$this->errorOutput(NO_TRANSERVER_CAN_USE);
}
/**************************************查询出所有正在使用的转码服务器中正在转码的视频*****************************/
$ids = array();
//存储正在转码中视频id
foreach ($servers as $k => $v) {
$trans = new transcode(array('host' => $v['trans_host'], 'port' => $v['trans_port']));
$task = json_decode($trans->get_transcode_status(), 1);
if ($task['return'] == 'success' && $task['running']) {
if ($task['waiting']) {
$task['running'] = array_merge($task['running'], $task['waiting']);
}
foreach ($task['running'] as $_k => $_v) {
if (!in_array($_v['id'], $ids)) {
$ids[] = $_v['id'];
}
}
}
}
/***************算出页面中正在转码的视频与实际服务器中转码视频以及等待的视频的差集,算出来视频id就是遗漏的视频**************/
$diffIds = array_diff($videos, $ids);
if (!$diffIds) {
$this->errorOutput(NO_VIDEO_LEAVE_OUT);
}
//将找出遗漏的视频提交重新转码
$curl = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir'] . 'admin/');
$curl->setSubmitType('get');
foreach ($diffIds as $k => $v) {
$curl->initPostData();
$curl->addRequestData('id', $v);
$curl->addRequestData('force_recodec', 1);
$curl->request('retranscode.php');
}
$this->addItem('遗漏的视频:' . implode(',', $diffIds) . '已经提交重新转码');
$this->output();
}
示例9: run
public function run()
{
if (!$this->input['stime']) {
$stime = TIMENOW - 24 * 3600;
} else {
$stime = strtotime($this->input['stime']);
}
if (!$this->input['etime']) {
$etime = TIMENOW;
} else {
$etime = strtotime($this->input['etime']);
}
$sql = "SELECT * FROM " . DB_PREFIX . "vodinfo WHERE 1 AND create_time >= '" . $stime . "' AND create_time <= '" . $etime . "' AND status NOT IN (0,4,5) AND vod_leixing != 4";
$q = $this->db->query($sql);
$video_path = array();
$videos = array();
while ($r = $this->db->fetch_array($q)) {
$video_tmp = explode('.', $r['video_filename']);
$video_path[$r['id']] = $r['video_base_path'] . $r['video_path'] . $video_tmp[0];
$videos[$r['id']] = $r;
}
if (!$video_path) {
$this->errorOutput('此时间段不存在视频');
}
$no_ismv = array();
foreach ($video_path as $k => $v) {
if (!file_exists($v . '.ismv') || !file_exists($v . '.ism')) {
$no_ismv[] = $k;
}
}
if (!$no_ismv) {
$this->errorOutput('此时间段的视频都存在ismv与ism文件');
}
//检测视频有没有转码中的,主要为了防止强制转码的任务
foreach ($no_ismv as $k => $v) {
if (checkStatusFromAllServers($v)) {
unset($no_ismv[$k]);
}
}
$curl = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir'] . 'admin/');
$curl->setSubmitType('get');
foreach ($no_ismv as $k => $v) {
$curl->initPostData();
$curl->addRequestData('id', $v);
$curl->addRequestData('force_recodec', 1);
if (in_array($videos[$v]['status'], array(2, 3))) {
$curl->addRequestData('audit_auto', $videos[$v]['status']);
}
$curl->request('retranscode.php');
}
$ids = implode(',', $no_ismv);
$this->addItem('没有ismv的视频有:' . $ids . ',已经提交重新转码');
$this->output();
}
示例10: get_video
public function get_video($vid = 0)
{
global $gGlobalConfig;
include_once ROOT_PATH . 'lib/class/curl.class.php';
$livmedia = new curl($gGlobalConfig['App_livmedia']['host'], $gGlobalConfig['App_livmedia']['dir'] . 'admin/');
$livmedia->initPostData();
$livmedia->addRequestData('id', $vid);
$livmedia->addRequestData('a', 'detail');
$vodinfo = $livmedia->request('vod.php');
$vodinfo = $vodinfo[0];
return is_array($vodinfo) && !empty($vodinfo) ? $vodinfo : array();
}
示例11: checklogin
private function checklogin($username, $password)
{
$curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir']);
$curl->setSubmitType('post');
$curl->setReturnFormat('json');
$curl->initPostData();
$curl->addRequestData('a', 'show');
$curl->addRequestData('username', $username);
$curl->addRequestData('password', $password);
$ret = $curl->request('get_access_token.php');
return $ret[0];
}
示例12: auth
public function auth()
{
$curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir']);
$curl->mAutoInput = false;
$curl->setClient(CUSTOM_APPID, CUSTOM_APPKEY);
$sql = 'SELECT * FROM ' . DB_PREFIX . 'applications ORDER BY id desc';
$q = $this->db->query($sql);
while ($row = $this->db->fetch_array($q)) {
echo $row['name'] . '<br />';
$row['dir'] = str_replace($row['admin_dir'], '', $row['dir']);
$curl->initPostData();
foreach ($row as $k => $v) {
$curl->addRequestData($k, $v);
}
$curl->addRequestData('bundle', $row['softvar']);
$ret = $curl->request('admin/apps.php');
}
$sql = 'SELECT * FROM ' . DB_PREFIX . 'modules ORDER BY id desc';
$q = $this->db->query($sql);
$app_main_module = array();
while ($row = $this->db->fetch_array($q)) {
echo $row['name'] . '<br />';
$row['dir'] = str_replace($row['admin_dir'], '', $row['dir']);
$row['main_module'] = 0;
if ($row['app_uniqueid'] == $row['mod_uniqueid']) {
$row['main_module'] = 1;
}
if ($row['menu_pos'] == -1) {
$row['main_module'] = 2;
}
$modules[$row['id']] = $row;
if ($row['main_module']) {
//纪录各个应用主模块 menu_pos优先
if ($modules[$app_main_module[$row['app_uniqueid']]]['main_module'] <= $row['main_module']) {
$app_main_module[$row['app_uniqueid']] = $row['id'];
}
}
}
if ($modules) {
foreach ($modules as $mid => $row) {
if ($row['main_module'] && in_array($row['id'], $app_main_module)) {
$row['main_module'] = 1;
} else {
$row['main_module'] = 0;
}
$curl->initPostData();
foreach ($row as $k => $v) {
$curl->addRequestData($k, $v);
}
$ret = $curl->request('admin/modules.php');
}
}
}
示例13: config
function config()
{
$curl = new curl('localhost', 'livsns/api/auth/');
$curl->setSubmitType('post');
$curl->setReturnFormat('json');
$curl->initPostData();
$curl->addRequestData('a', 'settings');
$ret = $curl->request('configuare.php');
$user_configs = array('base' => $ret['base'], 'define' => $ret['define']);
$curl = new curl('10.0.1.40', 'livworkbench/api/');
$curl->setSubmitType('post');
$curl->setReturnFormat('json');
$curl->initPostData();
$curl->setClient(CUSTOM_APPID, CUSTOM_APPKEY);
$curl->addRequestData('app', 'auth');
$curl->addRequestData('version', '1.0.0');
$curl->addRequestData('pre_release', '1');
$new_configs = $curl->request('config.php');
if ($new_configs) {
$doset = array();
foreach ($new_configs as $k => $v) {
if (is_array($v)) {
foreach ($v as $kk => $vv) {
if (!$user_configs[$k][$kk]) {
$doset[$k][$kk] = $vv;
}
}
}
}
}
if ($doset) {
$curl = new curl('localhost', 'livsns/api/auth/');
$curl->setSubmitType('post');
$curl->setReturnFormat('json');
$curl->initPostData();
$curl->addRequestData('a', 'doset');
foreach ($doset as $k => $v) {
foreach ($v as $kk => $vv) {
if (is_array($vv)) {
foreach ($vv as $kkk => $vvv) {
$curl->addRequestData($k . "[{$kk}][{$kkk}]", $vvv);
}
} else {
$curl->addRequestData($k . "[{$kk}]", $vv);
}
}
}
$ret = $curl->request('configuare.php');
}
print_r($doset);
print_r($curl);
}
示例14: access_token_expired
private function access_token_expired($access_token)
{
//获取需要修改的配置
require_once ROOT_PATH . 'lib/class/curl.class.php';
$curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir']);
$curl->setSubmitType('post');
$curl->setReturnFormat('json');
$curl->initPostData();
$curl->addRequestData('a', 'access_token_expired');
$curl->addRequestData('access_token', $access_token);
$ret = $curl->request('get_app_info.php');
return $ret[0];
}
示例15: get_tem_sort
public function get_tem_sort()
{
$fid = $this->input['fid'];
unset($this->input['appid'], $this->input['appkey']);
$host = $this->settings['App_publishsys']['host'];
$dir = $this->settings['App_publishsys']['dir'] . 'admin/';
$curl = new curl($host, $dir);
$curl->setSubmitType('post');
$curl->initPostData();
$curl->addRequestData('a', 'get_tem_sort');
$curl->addRequestData('fid', fid);
$tem_sort_info = $curl->request('template.php');
echo json_encode($tem_sort_info);
}