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


PHP curl::request方法代码示例

本文整理汇总了PHP中curl::request方法的典型用法代码示例。如果您正苦于以下问题:PHP curl::request方法的具体用法?PHP curl::request怎么用?PHP curl::request使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在curl的用法示例。


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

示例1: 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);
 }
开发者ID:h3len,项目名称:Project,代码行数:33,代码来源:out_trade_notify.php

示例2: verifyToken

 protected function verifyToken()
 {
     $gAuthServerConfig = $this->settings['App_auth'];
     if (!$gAuthServerConfig) {
         $this->user = array('user_id' => $this->input['user_id'], 'user_name' => $this->input['user_name'], 'group_type' => 1, 'appid' => $this->input['appid'], 'display_name' => $this->input['user_name'], 'visit_client' => 0);
         return;
     }
     if (!class_exists('curl')) {
         include_once ROOT_PATH . 'lib/class/curl.class.php';
     }
     $curl = new curl($gAuthServerConfig['host'], $gAuthServerConfig['dir']);
     $curl->initPostData();
     $postdata = array('appid' => $this->input['appid'], 'appkey' => $this->input['appkey'], 'access_token' => $this->input['access_token'], 'mod_uniqueid' => MOD_UNIQUEID, 'app_uniqueid' => APP_UNIQUEID, 'a' => 'get_user_info');
     foreach ($postdata as $k => $v) {
         $curl->addRequestData($k, $v);
     }
     $ret = $curl->request('get_access_token.php');
     //判定终端是否需要登录授权
     if ($ret['ErrorCode']) {
         $this->errorOutput($ret['ErrorCode']);
     }
     $this->user = $ret[0];
     if ($this->input['m2o_ckey'] == CUSTOM_APPKEY) {
         $this->user['group_type'] = 1;
     }
 }
开发者ID:h3len,项目名称:Project,代码行数:26,代码来源:configuare.php

示例3: __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);
开发者ID:h3len,项目名称:Project,代码行数:32,代码来源:convert.php

示例4: __getConfig

 public function __getConfig()
 {
     //获取mediaserver的里面视频类型的配置
     if ($this->settings['App_mediaserver']) {
         $curl = new curl($this->settings['App_mediaserver']['host'], $this->settings['App_mediaserver']['dir'] . 'admin/');
         $curl->setReturnFormat('json');
         $curl->initPostData();
         $curl->addRequestData('a', '__getConfig');
         $m_config = $curl->request('index.php');
     }
     if ($m_config && is_array($m_config)) {
         $video_type = $m_config[0]['video_type']['allow_type'];
     } else {
         $video_type = $this->default_type;
     }
     $video_type_arr = explode(',', $video_type);
     $flash_video_type = '';
     foreach ($video_type_arr as $k => $v) {
         $flash_video_type .= '*' . $v . ';';
     }
     $video_types = str_replace('.', '', $video_type);
     $this->settings['flash_video_type'] = $flash_video_type;
     $this->settings['video_type'] = $video_types;
     parent::__getConfig();
 }
开发者ID:h3len,项目名称:Project,代码行数:25,代码来源:vod_add_single_video.php

示例5: request

 /**
  * Single HTTP Request
  *
  * @param string $url The URL to request
  * @param array $options
  * @return bool
  */
 protected function request($url, $options = array())
 {
     $this->setHeader($this->get_clienttag_headers());
     $result = parent::request($url, $options);
     $this->resetHeader();
     return $result;
 }
开发者ID:jamesmcq,项目名称:o365-moodle,代码行数:14,代码来源:httpclient.php

示例6: 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'];
         }
         */
     }
 }
开发者ID:h3len,项目名称:Project,代码行数:34,代码来源:mmobject_update.php

示例7: 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('更新成功');
 }
开发者ID:h3len,项目名称:Project,代码行数:25,代码来源:infocenter.php

示例8: 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();
 }
开发者ID:h3len,项目名称:Project,代码行数:30,代码来源:templates.php

示例9: 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);
             }
         }
     }
 }
开发者ID:h3len,项目名称:Project,代码行数:30,代码来源:vote.php

示例10: 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();
 }
开发者ID:h3len,项目名称:Project,代码行数:63,代码来源:send_notify.php

示例11: 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();
 }
开发者ID:h3len,项目名称:Project,代码行数:56,代码来源:verify_transcode_videos.php

示例12: request

 protected function request($url, $options = array())
 {
     if ($this->token) {
         // Adds authorisation head to a request so that it can be authentcated
         $this->setHeader('Authorization: ' . $this->get_auth_header_name() . '"' . $this->token . '"');
     }
     $ret = parent::request($url, $options);
     // reset headers for next request
     $this->header = array();
     return $ret;
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:11,代码来源:googleapi.php

示例13: column_node

 public function column_node()
 {
     $curl = new curl($this->settings['App_publishcontent']['host'], $this->settings['App_publishcontent']['dir'] . 'admin/');
     $curl->initPostData();
     $curl->addRequestData('a', 'get_all_columns');
     $return = $curl->request('column.php');
     if (is_array($return) && !$return['ErrorCode']) {
         exit(json_encode($return));
     }
     exit($return);
 }
开发者ID:h3len,项目名称:Project,代码行数:11,代码来源:route2node.php

示例14: 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();
 }
开发者ID:h3len,项目名称:Project,代码行数:11,代码来源:tuji_get_name.php

示例15: 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();
 }
开发者ID:h3len,项目名称:Project,代码行数:54,代码来源:check_ismv.php


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