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


PHP Http::post方法代码示例

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


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

示例1: upload

 /**
  * 上传媒体文件.
  *
  * @param string $path
  *
  * @return string
  */
 public function upload($path)
 {
     if (!file_exists($path) || !is_readable($path)) {
         throw new Exception("文件不存在或不可读 '{$path}'");
     }
     $options = array('files' => array('media' => $path));
     $contents = $this->http->post(self::API_UPLOAD, array(), $options);
     return $contents['url'];
 }
开发者ID:supefun,项目名称:SupeFramework,代码行数:16,代码来源:Image.php

示例2: generate

 /**
  *
  * @param string $settlement_date
  * @param string $groupByCustomField
  * @return SettlementBatchSummary|Result\Error
  */
 public function generate($settlement_date, $groupByCustomField = NULL)
 {
     $criteria = ['settlement_date' => $settlement_date];
     if (isset($groupByCustomField)) {
         $criteria['group_by_custom_field'] = $groupByCustomField;
     }
     $params = ['settlement_batch_summary' => $criteria];
     $path = $this->_config->merchantPath() . '/settlement_batch_summary';
     $response = $this->_http->post($path, $params);
     if (isset($groupByCustomField)) {
         $response['settlementBatchSummary']['records'] = $this->_underscoreCustomField($groupByCustomField, $response['settlementBatchSummary']['records']);
     }
     return $this->_verifyGatewayResponse($response);
 }
开发者ID:atulparmar,项目名称:braintree_php,代码行数:20,代码来源:SettlementBatchSummaryGateway.php

示例3: push_to_repository

 static function push_to_repository($key, $module_name)
 {
     $source_file = new File(ModuleArchiver::MODULES_ARCHIVE_DIR . $module_name);
     $params = array();
     $params["key"] = $key;
     $params["module_name"] = $module_name;
     $params["my_file"] = $source_file;
     Http::post(Config::instance()->MODULE_REPOSITORY_UPLOAD_URL, $params);
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:9,代码来源:ModuleArchiver.class.php

示例4: capturarTransacao

 /**
  * Efetuando a captura de uma transacao
  * Para efetuar a captura e necessario ja ter setado o tid e o merchid
  * ATENCAO: A seguinte variavel RECEIVEXML deve estar setada como 1
  * no arquivo de configuracao (.ini) do cliente no servidor windows
  *
  * @return array('status' => bool, 'msg' => string);
  */
 public function capturarTransacao()
 {
     if (!$this->getTid()) {
         throw new Exception('TID não está definido');
     }
     if (!$this->getMerchid()) {
         throw new Exception('Merchid não está definido');
     }
     if (!$this->getValorTransacao()) {
         throw new Exception('O valor da transação não foi definido');
     }
     if (!$this->getWebservice()) {
         throw new Exception('Endereço do webservice não está definido');
     }
     // parametros a seres passados para o webservice para efetuar a captura
     $params = array('tid' => $this->getTid(), 'merchid' => $this->getMerchid(), 'price' => $this->getValorTransacao());
     $res = Http::post($this->getWebservice() . self::ACAO_CAPTURAR, $params);
     // caso o retorno nao seja xml, eh uma string com a descricao do erro
     if (strpos($res, 'xml') === false) {
         throw new Exception(strip_tags($res));
     }
     $xml = simplexml_load_string($res);
     if (!is_object($xml)) {
         throw new Exception('Erro na comunicação com o webservice');
     }
     switch (trim($xml->LR)) {
         case self::CAPTURA_SUCESSO:
             $msg = 'Captura realizada com sucesso.';
             $status = false;
             break;
         case self::CAPTURA_JA_EFETUADA:
             $msg = 'Captura ja efetuada anteriormente.';
             $status = true;
             break;
         case self::CAPTURA_NEGADA:
             $msg = 'Captura negada pelo Visanet.';
             $status = false;
             break;
         case self::CAPTURA_ERRO:
             $msg = 'Ocorreu um erro ao efetuar a captura. (Verifique a existência do TID)';
             $status = false;
             break;
         case self::CAPTURA_EXCEDEU_LIMITE_DIAS:
             $msg = 'Excedeu o limite de dias da autorizacao';
             $status = false;
             break;
         default:
             $msg = isset($xml->ARS) && !empty($xml->ARS) ? $xml->ARS : 'Nao foi possivel identificar o status da captura';
             $status = false;
             break;
     }
     return array('status' => $status, 'msg' => $msg);
 }
开发者ID:viniciusferreira,项目名称:cartoes,代码行数:61,代码来源:Visa.php

示例5: daemonFunc

 /**
  * 完善daemon处理函数,此函数必备
  *
  *
  */
 function daemonFunc()
 {
     require dirname(__FILE__) . '/../../config/testUI/config.php';
     $redis = new Predis\Client($_config['redis_server']);
     $http = new Http();
     while ($this->subProcessCheck()) {
         //处理队列
         $case_data = $redis->lpop($_config['queue_name']);
         if (empty($case_data)) {
             break;
         } else {
             $arr = json_decode($case_data, true);
             $url = $arr['host'] . $arr['url'];
             $query = $arr['param'];
             $method = strtoupper($arr['method']);
             //拼装表单提交数据
             $formdata = array();
             $temp_arry = explode('&', $query);
             foreach ($temp_arry as $item) {
                 list($k, $v) = explode('=', $item);
                 $formdata[$k] = $v;
             }
             //判断是否需要token
             if (isset($arr['token'])) {
                 $formdata['token'] = $arr['token'];
             }
             if ($method == 'GET') {
                 $http->get($url, $formdata);
             } else {
                 $http->post($url, $formdata);
             }
             $res = $http->getContent();
             //此处增加返回结果的判断
             $result = $arr['result'];
             if ($result == $res) {
                 $res_test = 1;
             } else {
                 $res_test = 0;
             }
             //                $req['url'] = $url;
             //                $req['data'] = $formdata;
             //$result =array();
             file_put_contents(realpath(dirname(__FILE__)) . '/../../output/testUI.log', $res_test . '|' . $result . '|' . $res . '|' . $url . '|' . json_encode($formdata) . "\n", FILE_APPEND);
         }
         //增加处理数,不增加处理数,就需要子进程本身有退出机制。
         //$this->requestCount++;
         //释放时间片
         usleep(5000);
     }
 }
开发者ID:mendianchun,项目名称:at,代码行数:55,代码来源:index.php

示例6: upload

 /**
  * 上传媒体文件.
  *
  * @param string $type
  * @param string $path
  * @param array  $params
  *
  * @return string
  */
 protected function upload($type, $path, $params = [])
 {
     if (!file_exists($path) || !is_readable($path)) {
         throw new Exception("文件不存在或不可读 '{$path}'");
     }
     if (!in_array($type, $this->allowTypes, true)) {
         throw new Exception("错误的媒体类型 '{$type}'");
     }
     $queries = ['type' => $type];
     $options = ['files' => ['media' => $path]];
     $url = $this->getUrl($type, $queries);
     $response = $this->http->post($url, $params, $options);
     $this->forever = false;
     return $response['media_id'];
 }
开发者ID:hexing-w,项目名称:wechat,代码行数:24,代码来源:Media.php

示例7: update

 public function update()
 {
     $group = Http::post("group");
     $group_id = Http::post("group_id");
     $permissions = Http::post("permission");
     $permission_model = DB::loadModel("users/permissions");
     $group_model = DB::loadModel("users/groups");
     $group_model->updateGroup($group_id, $group);
     $pids = array();
     foreach ($permissions as $id => $val) {
         $pids[] = $id;
     }
     $permission_model->setPermissions($group_id, $pids);
     Http::redirect("/user_groups");
 }
开发者ID:fire-coding,项目名称:gis,代码行数:15,代码来源:user_groups.php

示例8: send

 function send($recipients, $headers, $body)
 {
     global $wgVersion;
     $this->_sanitizeHeaders($headers);
     $headerElements = $this->prepareHeaders($headers);
     list($from, $textHeaders) = $headerElements;
     foreach ($recipients as $recipient) {
         if (version_compare($wgVersion, '1.16', '>=')) {
             $status = Http::post("http://theschwartz/theschwartz/inject", array("postData" => array("rcpt" => "{$recipient}", "env_from" => $from, "msg" => "{$textHeaders}" . "\n\n" . "{$body}")));
         } else {
             $status = Http::post("http://theschwartz/theschwartz/inject", 'default', array(CURLOPT_POSTFIELDS => array("rcpt" => "{$recipient}", "env_from" => $from, "msg" => "{$textHeaders}" . "\n\n" . "{$body}")));
         }
         wfDebugLog("enotif", __METHOD__ . ": injecting http://theschwartz/theschwartz/inject with params: {$recipient} {$from} {$headers['Subject']}", true);
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:15,代码来源:theschwartzhttp.php

示例9: auth

 function auth()
 {
     $user = is_null($this->registry->get("user")) ? new User() : $this->registry->get("user");
     if ($user->logged === false) {
         $user->login = !is_null(Http::post("login")) ? Http::post("login") : "";
         $user->password = !is_null(Http::post("password")) ? Http::post("password") : "";
         if ($user->login == "sa" && $user->password == "sa") {
             $this->registerModule("admin/system/system", "center_side");
             $this->display();
             exit;
         }
         $user->auth();
     }
     Http::redirect("/");
 }
开发者ID:fire-coding,项目名称:gis,代码行数:15,代码来源:index.php

示例10: update

 public function update()
 {
     $user = Http::post("user");
     $user_id = Http::post("user_id");
     $user["is_admin"] = $user["is_admin"] == "on" ? 1 : 0;
     $groups = Http::post("groups");
     $groups_ids = array();
     foreach ($groups as $id => $group) {
         $groups_ids[] = $id;
     }
     $user_model = DB::loadModel("users/user");
     $user_groups_model = DB::loadModel("users/groups");
     $user_model->update($user_id, $user);
     $user_groups_model->setGroups($user_id, $groups_ids);
     Http::redirect("/users");
 }
开发者ID:fire-coding,项目名称:gis,代码行数:16,代码来源:users.php

示例11: execute

 public function execute()
 {
     global $wgDevelEnvironment, $wgFlowerUrl;
     if ($wgDevelEnvironment) {
         \Wikia\Logger\WikiaLogger::instance()->setDevModeWithES();
     }
     \Wikia\Logger\WikiaLogger::instance()->pushContext(['task_id' => $this->mOptions['task_id']]);
     $runner = new TaskRunner($this->mOptions['wiki_id'], $this->mOptions['task_id'], $this->mOptions['task_list'], $this->mOptions['call_order'], $this->mOptions['created_by']);
     ob_start();
     $runner->run();
     $result = $runner->format();
     if ($runner->runTime() > TaskRunner::TASK_NOTIFY_TIMEOUT) {
         Http::post("{$wgFlowerUrl}/api/task/status/{$this->mOptions['task_id']}", ['noProxy' => true, 'postData' => json_encode(['kwargs' => ['completed' => time(), 'state' => $result->status, 'result' => $result->status == 'success' ? $result->retval : $result->reason]])]);
     }
     ob_end_clean();
     echo json_encode($result);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:17,代码来源:task_runner.php

示例12: callnake

 /**
  * 调用纳客接口.
  *
  * @param string $_method 接口方法名
  * @param array  $data    发送的数据
  */
 public function callnake($_method, array $data = array())
 {
     //实际请求地址
     $url = trim($this->interfaceUrl, '/ \\/') . '/Interface/GeneralInterfaceHandler.ashx';
     //请求方法名加入到参数中
     $data['do'] = $_method;
     //如果是商盟旗舰版,则参数中加入店铺ID
     if ($this->luckVersion === self::LUCK_VERSION_ULTIMATE) {
         $data['ShopID'] = $this->shopId;
     }
     //数据
     foreach ($data as $key => $value) {
         $data[$key] = $this->encryptor->encrypt($value);
     }
     //企业代码不加密
     $data['CompCode'] = $this->companyCode;
     $this->result = $this->http->post($url, $data);
     return $this->result;
 }
开发者ID:tianyong90,项目名称:lucksdk,代码行数:25,代码来源:LuckHelper.php

示例13: run

 /**
  * Execute the job
  *
  * @return bool
  */
 public function run()
 {
     //sleep() could be added here to reduce unnecessary use
     $ill = $this->params['ill'];
     foreach ($ill as $lang => $pages) {
         $iw = Interwiki::fetch($lang);
         if (!$iw) {
             continue;
         }
         $apiUrl = $iw->getAPI();
         if (!$apiUrl) {
             continue;
         }
         $apiUrl .= '?' . wfArrayToCGI(array('action' => 'purge', 'format' => 'json', 'titles' => implode('|', array_keys($pages))));
         Http::post($apiUrl);
         //TODO: error handling
     }
     return true;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:24,代码来源:InterlanguageCentralExtensionPurgeJob.php

示例14: upload

 function upload($v1, $v2)
 {
     $url = "http://sensor.aqicn.org/sensor/";
     $time = time();
     $data = array(array("t" => $time, "v" => $v1, "id" => 1), array("t" => $time, "v" => $v2, "id" => 2));
     $post = array("key" => DylosReaderConf::$sensorKey, "id" => DylosReaderConf::$sensorId, "clientVersion" => 2, "ip" => exec("/sbin/ifconfig wlan0 | grep 'inet addr:' | cut -d: -f2"), "mem" => memory_get_usage(), "data" => $data);
     $res = Http::post($url, json_encode($post));
     $json = json_decode($res);
     $path = realpath(dirname(__FILE__)) . "/logs/";
     mkdir($path);
     $filename = $path . "upload.dylos.pending.json";
     if (!isset($json->result) || $json->result != "ok") {
         $this->log("Postponning '" . json_encode($post) . "'\nServer says '{$res}'\n");
         $list = file_exists($filename) ? json_decode(file_get_contents($filename)) : array();
         file_put_contents($filename, json_encode(array_merge($list, $data)));
     } else {
         $this->log("Posted '" . json_encode($post) . "'.\nServer said '{$res}'\n");
         if (file_exists($filename)) {
             $data = json_decode(file_get_contents($filename));
             $post = array("key" => DylosReaderConf::$sensorKey, "id" => DylosReaderConf::$sensorId, "clientVersion" => 2, "mem" => memory_get_usage(), "data" => $data);
             $res = Http::post($url, json_encode($post));
             $this->log("Reposting ... Server says '{$res}'\n");
             $json = json_decode($res);
             if (!isset($json->result) || $json->result != "ok") {
                 /* In case the upload does not work, try 3 times before failing */
                 $this->retryUpload++;
                 if ($this->retryUpload < 3) {
                     return;
                 }
                 $time = time();
                 $tmpfile = $path . "errlog.dylos.failed." . $time;
                 file_put_contents($tmpfile, $res);
                 $tmpfile = $path . "upload.dylos.failed." . $time;
                 file_put_contents($tmpfile, json_encode($data));
             }
             unlink($filename);
             $this->retryUpload = 0;
         }
     }
 }
开发者ID:woolf-wen,项目名称:dylos,代码行数:40,代码来源:dylos.php

示例15: save

 function save()
 {
     $database = Http::post("database");
     $database_external = Http::post("database_external");
     $auth = Http::post("auth");
     $ad_server = Http::post("ad_server");
     if (!is_null($database) && !is_null($database_external) && !is_null($auth) && !is_null($ad_server)) {
         $config = new Config();
         $config->set("/settings/database/host", $database["host"]);
         $config->set("/settings/database/name", $database["name"]);
         $config->set("/settings/database/user", $database["user"]);
         $config->set("/settings/database/pass", $database["pass"]);
         $config->set("/settings/database_external/host", $database_external["host"]);
         $config->set("/settings/database_external/name", $database_external["name"]);
         $config->set("/settings/database_external/user", $database_external["user"]);
         $config->set("/settings/database_external/pass", $database_external["pass"]);
         $config->set("/settings/auth/mode", $auth["mode"]);
         $config->set("/settings/ad_server/address", $ad_server["address"]);
         $config->set("/settings/ad_server/account_sufix", $ad_server["account_sufix"]);
         $config->set("/settings/ad_server/base_dn", $ad_server["base_dn"]);
     }
     Http::redirect("/system");
 }
开发者ID:fire-coding,项目名称:gis,代码行数:23,代码来源:system.php


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