本文整理汇总了PHP中curl::setSubmitType方法的典型用法代码示例。如果您正苦于以下问题:PHP curl::setSubmitType方法的具体用法?PHP curl::setSubmitType怎么用?PHP curl::setSubmitType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类curl
的用法示例。
在下文中一共展示了curl::setSubmitType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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);
示例2: show
public function show()
{
$sql = "SELECT app_uniqueid, trade_number, out_trade_number, total_fee FROM " . DB_PREFIX . "orders\n WHERE order_type = 'THIRD_PARTY' AND trade_status = 'HAS_PAY' AND out_trade_notify IN(0,1)\n ORDER BY out_trade_notify_time ASC LIMIT 1";
$order = $this->db->query_first($sql);
//通知第三方订单
$sql = "SELECT * FROM " . DB_PREFIX . "app_access WHERE app_uniqueid = '" . $order['app_uniqueid'] . "'";
$app = $this->db->query_first($sql);
if (!empty($app)) {
$curl = new curl($app['host'], $app['dir']);
$curl->setSubmitType('post');
$curl->setReturnFormat('json');
$curl->initPostData();
$curl->addRequestData('a', $app['order_detail_func']);
$curl->addRequestData('trade_number', $order['out_trade_number']);
$curl->addRequestData('total_fee', $order['total_fee']);
$ret = $curl->request($app['request_file']);
if ($ret['success'] == 1) {
$status = $ret['data']['status'];
if ($status == 0) {
$curl->initPostData();
$curl->addRequestData('a', $app['pay_func']);
$curl->addRequestData('trade_number', $order['out_trade_number']);
$curl->addRequestData('total_fee', $order['total_fee']);
$ret = $curl->request($app['request_file']);
}
$this->db->update_data(array('out_trade_notify' => $status, 'out_trade_notify_time' => TIMENOW), 'orders', " trade_number = '" . $order['trade_number'] . "'");
} else {
$this->db->update_data(array('out_trade_notify' => 0, 'out_trade_notify_time' => TIMENOW), 'orders', " trade_number = '" . $order['trade_number'] . "'");
}
}
var_dump($ret);
var_dump($order);
}
示例3: 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('更新成功');
}
示例4: 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);
}
}
}
}
示例5: __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);
示例6: show
public function show()
{
$this->appstore->initPostData();
$this->appstore->addRequestData('a', 'get_sort');
$menu_group = $this->appstore->request('index.php');
$menu_group = $menu_group['sort'];
$this->appstore->initPostData();
$menu_apps = $this->appstore->request('index.php');
$menu_apps = $menu_apps['apps'];
$curl = new curl($this->product_server['host'] . ':' . $this->product_server['port'], '');
$curl->setClient(CUSTOM_APPID, CUSTOM_APPKEY);
$curl->setSubmitType('get');
$curl->setReturnFormat('json');
$curl->initPostData();
$curl->addRequestData('install', 1);
$curl->addRequestData('pre_release', 1);
$curl->addRequestData('app', $app);
$appinfo = $this->appinfo;
$program_url = $curl->request('check_version.php');
$appinfo['pre_release_url'] = $program_url;
$curl->initPostData();
$curl->addRequestData('install', 1);
$curl->addRequestData('app', $app);
$program_url = $curl->request('check_version.php');
$appinfo['release_url'] = $program_url;
$this->tpl->addVar('appinfo', $appinfo);
$this->tpl->addVar('_settings', $this->settings);
$this->tpl->addVar('menu_group', $menu_group);
$this->tpl->addVar('menu_apps', $menu_apps);
$this->tpl->outTemplate('admin_appstore');
}
示例7: 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();
}
示例8: get_water_config
public function get_water_config()
{
global $gGlobalConfig;
$curl = new curl($gGlobalConfig['App_material']['host'], $gGlobalConfig['App_material']['dir']);
$curl->setSubmitType('get');
$curl->initPostData();
$curl->addRequestData('a', 'get_water_config');
$ret = $curl->request('water.php');
$this->addItem($ret[0]);
$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: 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];
}
示例11: get_mediaserver_config
private function get_mediaserver_config()
{
//获取需要修改的配置
$curl = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir']);
$curl->setSubmitType('post');
$curl->setReturnFormat('json');
$curl->initPostData();
$curl->addRequestData('a', 'settings');
$settings = $curl->request('configuare.php');
$config = array('default_record_file_path' => !empty($settings) ? $settings['define']['UPLOAD_DIR'] : '');
return $config;
}
示例12: select_videos
public function select_videos()
{
$curl = new curl($this->settings['App_livmedia']['host'], $this->settings['App_livmedia']['dir']);
$curl->setSubmitType('get');
$curl->initPostData();
foreach ($this->input as $k => $v) {
$curl->addRequestData($k, $v);
}
$return = $curl->request('vod_get_many_videos.php');
$this->addItem($return[0]);
$this->output();
}
示例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: callBack
public function callBack()
{
$record = json_decode(html_entity_decode($this->input['data']), 1);
$curl = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir'] . 'admin/');
$curl->setSubmitType('post');
$curl->initPostData();
$data = array('id' => $record['id'], 'is_time_shift' => $record['time_shift'] ? 1 : 0, 'title' => $record['title'] ? $record['title'] : '精彩节目', 'filepath' => $record['file_path'], 'source' => $record['source'], 'is_mark' => $record['is_allow'], 'vod_sort_id' => $record['vod_sort_id'], 'audit_auto' => $record['audit_auto'], 'column_id' => $record['column_id'], 'channel_id' => $record['channel_id'], 'vod_leixing' => 3, 'start' => '0', 'end' => $record['duration'] * 1000, 'starttime' => $record['start_time'], 'create_time' => -1, 'force_recodec' => $record['force_codec'], 'appid' => $record['appid'], 'appkey' => $record['appkey'], 'comment' => $record['comment'], 'user_id' => $record['user_id'], 'user_name' => $record['user_name']);
foreach ($data as $k => $v) {
$curl->addRequestData($k, $v);
}
include_once ROOT_PATH . 'lib/class/program_record.class.php';
$obj_record = new programRecord();
$tmp_ret = array();
switch ($record['exit_status']) {
case 0:
//出错
$data = array('text' => '录制失败', 'state' => 2, 'content_id' => $record['id'], 'conid' => $record['id']);
$tmp_ret = $obj_record->updateLogs($data);
if ($tmp_ret) {
$obj_record->update_record_state($record['id']);
}
break;
case 1:
//成功
$data = array('text' => '录制成功', 'state' => 1, 'content_id' => $record['id'], 'conid' => $record['id']);
$tmp_ret = $obj_record->updateLogs($data);
if ($tmp_ret) {
$obj_record->update_record_state($record['id']);
}
break;
case 2:
//停止录制
/*
$data = array(
'text' => '停止录制',
'state' => 2,
'content_id' => $record['id'],
'conid' => $record['id'],
);
$obj_live->updateLogs($data);
$obj_live->update_record_state($record['id']);
*/
$this->addItem(array());
$this->output();
break;
default:
break;
}
$ret = $curl->request('create.php');
$this->addItem($ret);
$this->output();
}
示例15: 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];
}