本文整理汇总了PHP中curl_post函数的典型用法代码示例。如果您正苦于以下问题:PHP curl_post函数的具体用法?PHP curl_post怎么用?PHP curl_post使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了curl_post函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: slack_incoming_hook_post_with_attachments
function slack_incoming_hook_post_with_attachments($uri, $user, $channel, $icon, $payload, $attachments)
{
$data = array("text" => $payload, "channel" => "#" . $channel, "username" => $user, "icon_url" => $icon, "attachments" => array($attachments));
$data_string = "payload=" . json_encode($data, JSON_HEX_AMP | JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_PRETTY_PRINT);
mylog('sent.txt', $data_string);
return curl_post($uri, $data_string);
}
示例2: setProjectFilter
public function setProjectFilter($filter)
{
$url = $this->ws_url() . 'ws/set_project_filter';
$data = array('is_project_filter' => $this->input->post('is_project_filter'));
$response = curl_post($url, $data, TRUE);
return json_decode($response);
}
示例3: editKey
public function editKey($key, $data)
{
$url = $this->ws_url() . 'ws/key_post/' . $key;
$data['keybase_user_id'] = $this->ci->session->userdata('id');
$response = curl_post($url, $data, TRUE);
return json_decode($response);
}
示例4: translate
/**
* 百度翻译
*/
public function translate()
{
$query = \Input::get('w');
if (!$query) {
echo 'Word Is Required' . PHP_EOL;
exit;
}
//www.xunshu.org/xunshu/22/22665/7844538.html
$res = curl_post('http://fanyi.baidu.com/v2transapi', ['from' => 'en', 'to' => 'zh', 'query' => $query, 'transtype' => 'realtime', 'simple_means_flag' => '3']);
$result = [];
$data = json_decode($res, 1);
if (isset($data['dict_result']['simple_means']['symbols'][0])) {
$symbols = $data['dict_result']['simple_means']['symbols'][0];
$result['[En]'] = '[' . $symbols['ph_en'] . ' ]';
$result['[Am]'] = '[' . $symbols['ph_am'] . ' ]';
//echo -e "\e[1;31m skyapp exist \e[0m"
echo PHP_EOL . " [[1;31m{$query}[0m ]" . PHP_EOL;
if ($symbols['ph_en']) {
echo ' ' . "【英】[{$symbols['ph_en']} ],【美】[{$symbols['ph_am']} ]" . PHP_EOL;
}
foreach ($symbols['parts'] as $k => $v) {
$result['means'][$k] = $v['part'];
foreach ($v['means'] as $k1 => $v1) {
$result['means'][$k] .= ($k1 ? "," : '') . $v1;
}
echo ' ' . $result['means'][$k] . PHP_EOL;
}
echo PHP_EOL;
}
exit;
}
示例5: getAccessToken
function getAccessToken($code, $client_id, $client_secret, $url)
{
$curl_post_data = array('code' => $code, 'client_id' => $client_id, 'client_secret' => $client_secret);
$json = curl_post($url, $curl_post_data);
$response = json_decode(removeTrailingCommas(utf8_encode($json)));
return $response->{access_token};
}
示例6: getAccessToken
function getAccessToken($code, $client_id, $client_secret)
{
echo $code . $client_id . $client_secret;
$curl_post_data = array('code' => $code, 'client_id' => $client_id, 'client_secret' => $client_secret);
$response = curl_post($_GET["access_token_url"], $curl_post_data);
echo 'token: ' . $response;
return $response["access_token"];
}
示例7: query
function query($query, $post)
{
$args = array();
foreach (json_decode($post) as $k => $v) {
$args[$k] = $v;
}
$data = curl_post($query, $args);
return $data;
}
示例8: dnspod_update_ip
function dnspod_update_ip($record_id, $ip, $line)
{
$url = 'https://dnsapi.cn/Record.Modify';
$post = array('login_email' => USERNAME, 'login_password' => PASSWORD, 'format' => 'json', 'lang' => 'cn', 'error_on_empty' => 'no', 'domain_id' => DOMAIN_ID, 'sub_domain' => SUB_DOMAIN, 'record_id' => $record_id, 'record_type' => 'A', 'record_line' => $line, 'value' => $ip, 'ttl' => '120');
$json_result = curl_post($url, $post);
$array_result = json_decode($json_result, TRUE);
$result = $array_result['status']['code'];
return $result == 1;
}
示例9: loginCms
public function loginCms()
{
$post_fields['username'] = USERNAME;
$post_fields['password'] = PASSWD;
$post_fields['code'] = 'abcd';
$url = LOGINURL . '&dosubmit=1';
$res = curl_post($url, $post_fields);
if (!strpos($res, "登录成功")) {
return false;
}
return $res;
}
示例10: info
public function info()
{
$data = array();
$data['typeid'] = I('get.id');
$data['puid'] = I('get.puid');
$result = curl_post($data, rtrim(C('API_PATH'), '/') . '/?s=Supply/Index/index&api=SupplyBom.selbyusertypeid');
$arr = json_decode($result, TRUE);
// echo "<pre>";
// print_r($arr);
$this->assign('info', $arr['api_result']);
$this->display();
}
示例11: execPayment
/**
* @param Array $fomrs
* @param Boolean $useSSL
* @return response string
*/
function execPayment($fomrs, $useSSL)
{
$gofpay_gateway_url = trim(Configuration::get('GOFPAY_GATEWAY_URL')) . '/' . Configuration::get('GOFPAY_GATEWAY_VERSION') . '/gateway';
if ($useSSL) {
//crul请求,
$info = curl_post($gofpay_gateway_url, http_build_query($fomrs, '', '&'));
} else {
//普通http请求
$info = http_post($gofpay_gateway_url, http_build_query($fomrs, '', '&'));
}
return explode_return_str($info);
}
示例12: _write_cache_file
function _write_cache_file($files, $cache)
{
$defaults = array('compilation_level' => 'SIMPLE_OPTIMIZATIONS', 'output_format' => 'json', 'output_info' => 'compiled_code');
$js = '';
foreach ($files as $file) {
$fs_path = dir_path_for('js') . $file;
if (file_exists($fs_path)) {
$js .= fread(fopen($fs_path, 'r'), filesize($fs_path));
}
}
$defaults["js_code"] = $js;
$compiled_reponse = curl_post(GOOGLE_CLOSURE_COMPILER, $defaults);
fwrite($cache, json_decode($compiled_reponse)->compiledCode);
}
示例13: getSectionsByDept
public function getSectionsByDept($deptAbbr)
{
$params = array('term' => $this->termSlug, 'dept' => str_pad($deptAbbr, 4, ' '), 'crse_time' => 'Courses Offered Any Time', 'submit' => 'Go');
$url = "https://webcenter.studentservices.tufts.edu/courses/subject_listing.asp";
// http_build_query ensures the right encoding for the POST
$result = curl_post($url, http_build_query($params));
$regex = "/450\\)\"\\>([A-Z]+)\\s*(\\d{4})([A-Z0-9\\-]+)\\s*?<.+?\\d\\.\\d.+?\\'\\>\\<b\\>(.*?)\\&/";
preg_match_all($regex, $result, $matches, PREG_SET_ORDER);
$sections = array();
foreach ($matches as $match) {
$sections[] = array('CourseNum' => trim($match[2]), 'Num' => trim($match[3]), 'Professor' => formatProfessor($match[4]));
}
return $sections;
}
示例14: getNamazVakitleri
function getNamazVakitleri($ulke_id, $sehir_id, $ilce_id = '', $periyot = '')
{
require_once SITE_PATH . '/simple_html_dom.php';
$postdata = http_build_query(array('Country' => $ulke_id, 'State' => $sehir_id, 'City' => $ilce_id, 'period' => 'Aylik'));
$result = curl_post('http://www.diyanet.gov.tr/tr/PrayerTime/PrayerTimesList', $postdata);
$html = str_get_html($result);
$deneme = array();
$deneme[0] = boslukTemizle(@$html->find('table tr', 0)->plaintext);
$deneme[1] = boslukTemizle(@$html->find('table tr', 1)->plaintext);
$deneme[0][1] = 'Imsak';
$deneme[0][2] = 'Gunes';
$deneme[0][3] = 'Ogle';
$deneme[0][4] = 'Ikindi';
$deneme[0][5] = 'Aksam';
$deneme[0][6] = 'Yatsi';
$deneme[0][7] = 'Kible';
if ($periyot == '') {
// Günlük
if (empty($deneme[1])) {
return '[{"error":"Namaz vakitlerine ulaşılamadı. Lütfen tekrar deneyiniz."}]';
} else {
return json_turkce(array(array_combine($deneme[0], $deneme[1])));
}
} elseif ($periyot == 'haftalik') {
// Haftalık
$combine = array();
for ($i = 1; $i < 8; $i++) {
$veri = array_combine($deneme[0], boslukTemizle($html->find('table tr', $i)->plaintext));
if ($veri) {
$combine[] = $veri;
}
}
echo json_encode($combine);
} elseif ($periyot == 'aylik') {
// Aylık
$combine = array();
for ($i = 1; $i < 34; $i++) {
$veri = array_combine($deneme[0], boslukTemizle($html->find('table tr', $i)->plaintext));
if ($veri) {
$combine[] = $veri;
}
}
echo json_encode($combine);
}
}
示例15: getresult
function getresult($url)
{
$postData = "------WebKitFormBoundaryy9zMscQCwUGxoejM\r\n";
$postData .= "Content-Disposition: form-data; name=\"urllink\"\r\n\r\n";
$postData .= $url . "\r\n";
$postData .= "------WebKitFormBoundaryy9zMscQCwUGxoejM\r\n";
$postData .= "Content-Disposition: form-data; name=\"url-2txt\"\r\n\r\n\r\n\r\n";
$postData .= "------WebKitFormBoundaryy9zMscQCwUGxoejM--\r\n";
$post_url = "http://deeplearning.cs.toronto.edu//api/url.php";
$header = array("Host: deeplearning.cs.toronto.edu", "Content-Length: " . strlen($postData), 'X-Requested-With: XMLHttpRequest', 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryy9zMscQCwUGxoejM', 'Accept-Language: zh-CN,zh;q=0.8', 'X-Requested-With: XMLHttpRequest', 'X-Requested-With: XMLHttpRequest');
$str = curl_post($header, $postData, $post_url);
$pattern = '#Sentence:</h4><ul><li>(.*)</li></ul><br/><h4>#';
$sentence = getPatternResult($pattern, $str);
if ($sentence == "error") {
return "error";
} else {
return translate($sentence);
}
}