本文整理汇总了PHP中curlPost函数的典型用法代码示例。如果您正苦于以下问题:PHP curlPost函数的具体用法?PHP curlPost怎么用?PHP curlPost使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了curlPost函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: startProcess
function startProcess($db)
{
$businessComfirmUrl = Yii::app()->params['orderUrl'] . "update/order/business-confirm-order";
$time = time();
$formatTime = date('Y-m-d H:i:s', $time);
try {
//查找订单
$payTime = $time - 1800;
$sql = "SELECT b.business_id,o.order_sn from " . get_tables('business_info') . " as b left join " . get_tables('order_info') . " as o on b.business_id=o.business_id WHERE b.express_type in (2, 11, 12) and o.order_status=1 and o.express_type > 0 and o.pay_time <= " . $payTime . " LIMIT 100";
$data = $db->createCommand($sql)->queryAll();
if (!empty($data)) {
foreach ($data as $k => $v) {
$post = ['business_id' => $v['business_id'], 'order_sn' => $v['order_sn'], 'user_id' => 1, 'user_name' => 'jiaoben', 'source' => 'autoStockUp'];
$return = curlPost($businessComfirmUrl, $post);
if ($return['code'] != 0) {
addLog("data:" . json_encode($return, JSON_UNESCAPED_UNICODE) . '|time:' . $formatTime);
echo $v['order_sn'] . ":fail" . "\r\n";
} else {
echo $v['order_sn'] . ":success" . "\r\n";
}
}
echo "data update:" . count($data) . "\r\n";
} else {
echo "no data \r\n";
}
echo 'finish';
} catch (Exception $e) {
$msg = "filename:autoStockUp|functionname:start_process|error:" . $e->getMessage() . "|time:" . $formatTime;
echo $msg . "\r\n";
addLog($msg);
}
}
示例2: index
public function index()
{
if (IS_GET) {
$this->display('index');
} else {
$id = $_POST['project_id'];
if ($_POST['type'] == 1) {
$data = M('ProjectAttach')->where(array('project_id' => $id))->getField('investor_id', true);
} else {
if ($_POST['type'] == 2) {
$data = M('ProjectInvestor')->where(array('project_id' => $id, 'status' => array(array('egt', 4), array('elt', 8), 'AND')))->getField('investor_id', true);
} else {
if ($_POST['type'] == 3) {
$data = M('ProjectInvestor')->where(array('project_id' => $id, 'status' => 9))->getField('investor_id', true);
}
}
}
if ($data) {
$phones = M('UsersDetail')->where(array('id' => array('in', $data), 'phone' => array('neq', '')))->getField('phone', true);
$phonelist = implode(',', $phones);
$count = count($phones);
$mac = md5(NOW_TIME . C('SMSKEY'));
$info = array('phone' => $phonelist, 'count' => $count, 'content' => $_POST['content'], 'time' => NOW_TIME, 'mac' => $mac);
$url = 'http://www.dreammove.cn/Sms/sendsms.html';
$ret = curlPost($url, $info);
if ($ret == 1) {
$this->success('短信发送成功。' . $ret);
} else {
$this->error('短信发送失败。' . $ret);
}
}
}
}
示例3: getCommand
/**
* @param $params
* @return bool
*/
public function getCommand($params)
{
$mnc = new MNC();
$post = array('channelId' => $params['channelId'], 'fee' => $params['fee'], 'ip' => $params['ip'], 'extra' => $params['order_id'], 'imsi' => $params['imsi'], 'gameName' => $params['app_name'], 'chargeName' => $params['iap_name']);
$interface_url = 'http://121.41.58.237:8981/center/getCommand.sys';
$mac = $post['channelId'] . $post['fee'] . $post['ip'] . $post['extra'] . urlencode($post['gameName']) . urlencode($post['chargeName']) . $mnc->ctcc_config['key'];
$post['mac'] = strtoupper(md5($mac));
$code = curlPost($interface_url, $post);
//json
$code_arr = json_decode($code, true);
$msg = $code_arr + $params;
$msg['timestamp'] = $_SERVER['REQUEST_TIME'];
$msg['sign'] = md5($msg['app_id'] . $msg['iap_id'] . $msg['fee'] . $msg['order_id'] . $msg['behavior_status'] . $msg['timestamp']);
//写日志
/*M('Logs')->add(array(
'created'=>TIME,
'title'=>'getCommand',
'content'=>$code,
));*/
//消息加密
$msg = Aviup::encrypt(json_encode($msg));
$code_arr = json_decode($code, true);
$resultCode = $code_arr['resultCode'];
if ($resultCode == '0000') {
$this->ajaxReturn(array('status' => 0, 'msg' => $msg), 'JSON', JSON_UNESCAPED_UNICODE);
} else {
//失败原因加入订单
$error_text = Aviup::encrypt(json_encode(array('errordescription' => $mnc->ctcc_error[$resultCode], 'order_id' => $params['order_id']), JSON_UNESCAPED_UNICODE));
M('Statistics')->where(array('id' => $params['order_id']))->setField(array('fail_reasion' => $error_text));
$this->ajaxReturn(array('status' => 1, 'msg' => $error_text), 'JSON', JSON_UNESCAPED_UNICODE);
}
return true;
}
示例4: updataKml
function updataKml($kmls, $starttime, $file = '', $source = 1, $topic)
{
//访问API
$kmlUpdateApi = getConfig('kmlUpdateApi');
$unique = unique_arr($kmls);
//去重
//print_r($unique);exit;
$soadata = formatApiData($unique);
//去重
$returnData = curlPost($kmlUpdateApi, array('data' => $soadata));
logs($returnData, 1, 'consumer', $topic);
print_r($returnData);
exit;
//logs(' Access :'.$kmlUpdateApi, 1, 'consumer',$topic);
//logs(' Params is:'.json_encode($data), 1, 'consumer',$topic);
//logs(' Return is:'.$returnData, 1, 'consumer',$topic);
$cachePath = getconfig('kmlCachePath');
$cacheBack = getconfig('kmlCacheBak');
//验证还回结果
$objs = json_decode($returnData);
if (empty($returnData) || $objs->status != 0 || empty($objs->data)) {
if ($source == 2) {
$dir = $cacheBack . '/' . date('Y-m-d') . '/' . $topic;
mkFolder($dir);
$toPath = $dir . '/' . basename($file);
moveFile($file, $toPath);
logs(date('H:i:s') . ' API error:' . $objs->msg . '; file:' . $file . ' has move to ' . $toPath, 1, 'consumer', $topic);
} else {
if ($objs->status < 3) {
$cacheTopicPath = $cachePath . '/' . $topic;
mkFolder($cacheTopicPath);
$filename = basename($file);
$source = $cacheTopicPath . '/' . $filename;
file_put_contents($source, $data);
logs(date('H:i:s') . ' API error:' . $objs->msg . '; file:' . $file . ' has backup to ' . $source, 1, 'consumer', $topic);
} else {
$backFile = $cacheBack . '/' . basename($file);
moveFile($file, $backFile);
logs(date('H:i:s') . ' API error:' . $objs->msg . '; file ' . basename($file) . 'has move to ' . $backFile, 1, 'consumer', $topic);
}
}
}
if ($source == 2) {
if (file_exists($file)) {
unlink($file);
}
}
$arr = object2Array($objs);
$returnKml = $arr['data'];
$insertNum = 0;
if ($source == 1) {
$insertNum = addKml($returnKml, $kmls, $topic);
}
logs('kafka num:' . count($kmls) . ',send data num:' . count($unique) . ', API return:' . count($returnKml) . ',insertNum:' . $insertNum . ',Time: ' . getTime($starttime), 1, 'consumer', $topic);
$kmls = '';
}
示例5: imgUploadAlbum
public function imgUploadAlbum($gid, $aid, $imageURL, $imageText)
{
$imageText = str_replace(' ', '%20', $imageText);
$data = array("file1" => "@" . $this->imgSave($imageURL));
$server = api("photos.getUploadServer", "album_id={$aid}&group_id={$gid}");
$res = curlPost($server->response->upload_url, $data);
$upload = json_decode($res);
$save = api("photos.save", "group_id={$gid}&caption={$imageText}&album_id={$upload->aid}&server={$upload->server}&photos_list={$upload->photos_list}&hash={$upload->hash}");
return $save;
//return $save->response[0]->id;
}
示例6: sendCallDoneInfo
function sendCallDoneInfo($request, $stage)
{
global $apiurl;
global $agentid;
$callduration = getValueFromArray($request, 'callduration');
$status = getValueFromArray($request, 'status');
$recordurl = getValueFromArray($request, 'data');
$message = getValueFromArray($request, 'message');
$data = array("callduration" => $callduration, "status" => $status, "recordurl" => $data, "message" => $message, "stage" => $stage, "agent" => $agentid, "type" => "nextcall");
curlPost($apiurl . '/api/agent.php', $data);
}
示例7: getinfo
public function getinfo()
{
if (IS_GET) {
$mac = md5($_GET['time'] . C('SMSKEY'));
if ($mac != $_GET['mac']) {
return false;
}
$data = array('userid' => 416, 'account' => 'HY-jmzc', 'password' => 'Hj1234', 'action' => 'overage');
// 短信发送
$ret = curlPost($this->url, $data);
header("Content-type:text/xml;charset=utf-8");
echo $ret;
}
}
示例8: array
<?php
/**
* 客户端测试代码
*/
$data = array('method' => 'save', 'index' => 'test', 'key' => 1, 'field' => array('testid' => rand(1, 9999), 'value' => '这里是值'));
$data = json_encode($data);
$rst = curlPost("http://192.168.1.203/Psearch/", $data);
echo $rst;
exit;
function curlPost($url, $data = array(), $ref = '', $timeout = 10, $header = "")
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_REFERER, $ref);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, "Psearch-Client");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
示例9: insert
public function insert()
{
$login_pass = getRandomNum(8);
$data['login_user'] = I('post.mobile');
$data['login_pass'] = md5($login_pass);
$member = M('Member')->where(array('login_user' => $data['login_user']))->find();
if ($member) {
$this->error('会员已经存在', '?c=Shop&a=add');
}
$data['type'] = 1;
$member_id = M('Member')->add($data);
if ($member_id < 1) {
$this->error('服务器忙,请稍侯尝试', '?c=Shop&a=add');
}
$_account = 'cf_zcsd';
$_password = '69wZ74';
$_url = 'http://106.ihuyi.cn/webservice/sms.php?method=Submit&format=json';
$data = array('account' => $_account, 'password' => $_password, 'mobile' => $login_user, 'content' => '亲爱的客户大大,您的吆喝密码是【' . $login_pass . '】 小的马不停蹄给您送来了,敬请笑纳,么么哒!');
$res_json = curlPost($_url, $data, 5);
$model = D('Shop');
if ($model->create()) {
$filelist = $this->getUploads();
foreach ($filelist as $item) {
//$data[$item['key']] = $item['savepath'].$item['savename'];
$model->__set($item['key'], $item['savepath'] . $item['savename']);
}
$shop_id = $model->add();
if ($shop_id !== false) {
$data = array();
$data['shop_id'] = $shop_id;
$keywords = $_POST['keywords'];
//I('post.keywords');
foreach ($keywords as $title) {
if (empty($title)) {
continue;
}
$data['title'] = $title;
M('ShopKeywords')->add($data);
}
$return['msg'] = '数据保存成功!';
$this->success($return['msg'], '?c=Shop&a=contract&id=' . $shop_id);
} else {
$return['msg'] = '数据写入错误!';
$this->error($return['msg'], '?c=Shop&a=add');
}
} else {
$return['msg'] = $model->getError();
$this->error($return['msg'], '?c=Shop&a=add');
}
}
示例10: array
<?php
require 'base.php';
$url = "http://114.215.189.210/api.php/Api/Public/about";
$post_data = array();
$oupput = curlPost($url, $post_data);
print_r($oupput);
示例11: curlPost
if (isset($find['data'])) {
$curl = ['code' => 200, 'data' => $find['data']];
} else {
$curl = curlPost($post_data, $redirect_url);
}
$date = date('Y/m/d H:i:s') . ' +0000';
$mail = $_GET['email'];
if (strstr($curl['data'], "transStatus=Success")) {
$database['myorderbox']->insert(['id' => $_GET['ref'], 'data' => $curl['data']]);
$success = true;
}
} else {
if ($pingback->isCancelable()) {
$checksum = generateChecksum($productId, $price, $price, 'N', $rkey, $key);
$post_data = 'transid=' . $productId . '&status=N&rkey=' . $rkey . '&checksum=' . $checksum . '&sellingamount=' . $price . '&accountingamount=' . $price;
$curl = curlPost($post_data, $redirect_url);
$curl['code'] = 1001;
}
}
header('HTTP/1.1 ' . $curl['code']);
$insert = apc_store('transid-' . $productId, $curl['data'], 3600);
if ($curl['code'] == 200 && $success) {
if ($insert) {
echo 'OK';
} else {
print_r($insert);
}
} elseif ($curl['code'] == 1001) {
echo 'OK';
} else {
print_r($response);
示例12: curl_fopen
/**
* 支持https的访问
*/
function curl_fopen($url, $limit = 0, $post = array(), $cookie = '', $bysocket = FALSE, $ip = '', $timeout = 20, $block = TRUE)
{
$__times__ = isset($_GET['__times__']) ? intval($_GET['__times__']) + 1 : 1;
if ($__times__ > 2) {
return '';
}
$url .= (strpos($url, '?') === FALSE ? '?' : '&') . "__times__={$__times__}";
$return = '';
$matches = parse_url($url);
if (isset($matches['host']) && isset($matches['scheme'])) {
$return = curlPost($url, $post, $timeout);
}
return $return;
}
示例13: array
$questions[] = array(
'question' => 'Kilala bilang "Huseng Batute"',
'options' => array('Apolinario Mabini', 'Jose Corazon de Hesus', 'Gregorio H. del Pilar', 'Melchora Aquino'),
'answer' => 1
);
$questions[] = array(
'question' => 'What is the national flower of the Philippines?',
'options' => array('Sampaguita', 'Rose', 'Ilang Ilang', 'Daisy'),
'answer' => 0
);
$questions[] = array(
'question' => 'Who of the following explorers arrived in the Philippines in 1521?',
'options' => array('Aubrey', 'Jaynard', 'Elaine', 'Marko'),
'answer' => 0
);*/
#$arr = json_decode(file_get_contents('http://admin:1234@192.168.20.75/engage/api/mchoice/dtl/id/quiz/format/json'),TRUE);
$quiz_type_id = $_POST['type'];
$topic_id = $_POST['topic_id'];
$num_of_q = $_POST['qnum'];
$status = $_POST['status'];
$loadQuesDtl = array('type' => $quiz_type_id, 'topic_id' => $topic_id, 'qnum' => $num_of_q, 'status' => $status);
// $loadQuesUrl='http://admin:1234@162.209.21.251/engage_cms/engage/api/quizsql/loadquestion/';
$loadQuesUrl = $basePath . '/loadQuestion/';
$loadQuesDb = curlPost($loadQuesDtl, $loadQuesUrl);
$questions = json_decode($loadQuesDb, TRUE);
#$rand_questions = ($questions);//array('questions' => $questions);
$arr = array('questions' => $questions);
echo json_encode($arr);
示例14: array
<?php
// CREATING A MATCH
require "init.php";
$matchid = $_POST['matchid'];
$currentRound = $_POST['currRound'];
$scoreFindDtl = array('match_id' => $matchid, 'round' => $currentRound);
$scoreFindUrl = 'http://admin:1234@162.209.21.251/engage_cms/engage/api/quizsql/findScoreId/';
$scoreFindDb = curlPost($scoreFindDtl, $scoreFindUrl);
$row = json_decode($scoreFindDb, TRUE);
//$score_position=serialize($row[0]['score_position']);
//$score_value=intval($row[0]['score_value']);
//$score_answer=intval($row[0]['score_answer']);
//$score = array();
//$score[$score_position]=array('score'=>$score_value,'answer'=>$score_answer);
$score = array();
foreach ($row as $r) {
$sp = $r['score_position'];
$sv = intval($r['score_value']);
$sa = intval($r['score_answer']);
$score[$sp] = array('score' => $sv, 'answer' => $sa);
}
$status = 'success';
echo json_encode($score);
示例15: array
<?php
// CREATING A MATCH
require "init.php";
$matchid = $_POST['matchid'];
$round = $_POST['currRound'];
$position = $_POST['position'];
$score = $_POST['score'];
$answer = $_POST['answer'];
$status = 'pending';
$scoreInsertDtl = array('matchid' => $matchid, 'round' => $round, 'position' => $position, 'score' => $score, 'answer' => $answer);
// $scoreInsertUrl='http://admin:1234@162.209.21.251/engage_cms/engage/api/quizsql/insertScore/';
$scoreInsertUrl = $basePath . '/insertScore/';
$scoreInsertDb = curlPost($scoreInsertDtl, $scoreInsertUrl);
$status = $scoreInsertDb == true ? "success" : "";
$arr = array('status' => $status);
echo json_encode($arr);