本文整理汇总了PHP中doCurl函数的典型用法代码示例。如果您正苦于以下问题:PHP doCurl函数的具体用法?PHP doCurl怎么用?PHP doCurl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了doCurl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: read_myEdit
public function read_myEdit()
{
if (!$this->session->userdata('access_token')) {
redirect('login', 'refresh');
} else {
$data = $this->tq_header_info();
$document_id = $this->input->get('document_id');
// var_dump($document_id);exit;
$results = doCurl(API_BASE_LINK . 'priest_preach/read_myEdit_by_id?document_id=' . $document_id);
// var_dump($results);exit;
if ($results && $results['http_status_code'] == 200) {
$content = json_decode($results['output']);
// var_dump($content);exit;
$status_code = $content->status_code;
if ($status_code == 200) {
$data['results'] = $content->results->rows;
$data['pre_id'] = $content->results->pre_id;
$data['next_id'] = $content->results->next_id;
}
} else {
show_404();
exit;
}
$this->load->view('priest_preach/pp_read_view', isset($data) ? $data : "");
}
}
示例2: uploadTrack
function uploadTrack($track_filepath, $user_id, $task_date)
{
//Upload track to Doarama (create new activity)
$data = array('gps_track' => "@{$track_filepath}");
$response = doCurl("activity", $data, $user_id);
$data = json_decode($response, true);
$activity_id = $data["id"];
//Next set activity info https://api.doarama.com/api/0.2/activityType
/* 27 Fly - Hang Glide
28 Fly - Sailplane / Glider
29 Fly - Paraglide */
$data = '{"activityTypeId":29}';
//TODO: refactor to not just be paragliding
doCurl("activity/{$activity_id}", $data, $user_id);
//TODO: replace with your own DB initialization. I set mine to transactional since I don't want to populate
//it with bad entries if the track upload fails.
$conn = initDB();
$conn->autocommit(FALSE);
//Create a key for our local DB that we can use to link to a visualization.
//I use a key that given a date and a competition name will map to one specific visualization for that day
$league_key = "socal-{$task_date}";
//TODO: factor out for other leagues.
//Create an entry in the DB that maps a doarama activity_id to a unique_user_id in your local DB
//Since naming pilots in the API is done in the order of upload, if you want to name the tracks with
//user names make sure to be able to query your DB for activities that map to the end visualization
//and can be sorted in the order they were created. I've setup my DB to populate date_created automatically
$sql = "INSERT INTO user_activities (USER_ID, ACTIVITY_ID, LEAGUE_KEY) VALUES (?, ?, ?)";
$types = "iis";
$params = array($user_id, $activity_id, $league_key);
insert_row($conn, $sql, $types, $params);
//TODO replace with your own DB implementation
//TODO: update with your own DB implementation
//Try to find the doarama_key in our DB from our league_key, if we don't get any results it means we haven't
//yet created a visualization so we'll need to make one and save the Doarama Key in our DB
$sql = "SELECT doarama_key FROM doaramas WHERE league_key = ?";
$rows = run_stmt_query($conn, $sql, "s", array($league_key));
if (count($rows) < 1) {
// Create Visualization
$data = '{"activityIds":[' . $activity_id . ']}';
$response = doCurl("visualisation", $data, $user_id);
//get doarama_key
$data = json_decode($response, true);
$doarama_key = $data["key"];
//TODO: update with your own DB implementation
//insert into DB
$sql = "INSERT INTO doaramas (league_key, doarama_key) VALUES (?, ?)";
$types = "ss";
$params = array($league_key, $doarama_key);
insert_row($conn, $sql, $types, $params);
} else {
$doarama_key = $rows[0]['doarama_key'];
// Add activity to visualization
$data = '{"visualisationKey" : "' . $doarama_key . '", "activityIds": [' . $activity_id . ']}';
doCurl("visualisation/addActivities", $data, $user_id);
}
//TODO: update with your DB implementation
//all done now, can commite the transaction
$conn->commit();
$conn->close();
}
示例3: admin_login_log
public function admin_login_log($admin_id)
{
$result = doCurl(API_BASE_LINK . 'tq_admin_header_info/admin_login_log?admin_id=' . $admin_id);
if (isset($result) && $result['http_status_code'] == 200) {
$contents = json_decode($result['output']);
$content = $contents->results;
return true;
}
}
示例4: index
public function index()
{
$access_token = $this->session->userdata('access_token');
if ($access_token) {
$this->session->unset_userdata('access_token');
redirect(site_url('login'), 'refresh');
} else {
$user_name_email = trim($this->input->post('user_name'));
$password = $this->input->post('password');
$checkcode1 = strtolower(trim($this->input->post('checkcode')));
$checkcode = md5($checkcode1);
$cookie_checkcode = $this->input->cookie("checkpic");
if (!empty($checkcode1) && $checkcode != $cookie_checkcode) {
$temp_checkcode = $this->input->post('checkcode');
if (!empty($temp_checkcode)) {
$data['error'] = '验证码输入错误!';
}
$this->load->view('login_view', isset($data) ? $data : "");
} else {
if (!empty($user_name_email)) {
$result = doCurl(API_BASE_LINK . 'login/login_email/find?user_name_email=' . $user_name_email . '&password=' . $password);
}
if (isset($result) && $result['http_status_code'] == 400) {
// var_dump($result);exit;
$result = json_decode($result['output']);
$status_code = $result->status_code;
$message = $result->message;
if ($status_code == 400) {
$data['error'] = $message;
} else {
if ($status_code == 401) {
$data['error'] = $message;
} else {
if ($status_code == 402) {
$data['error'] = $message;
}
}
}
} else {
if (isset($result) && $result['http_status_code'] == 200) {
// var_dump($result);exit;
$result = json_decode($result['output']);
$status_code = $result->status_code;
$content = $result->results;
$user_id = $result->results->account_id;
$token = $result->results->access_token;
$this->session->set_userdata('access_token', $token);
$this->session->set_userdata('user_id', $user_id);
redirect('home', 'refresh');
}
}
$this->load->view('login_view', isset($data) ? $data : "");
}
}
}
示例5: delete_category
public function delete_category(&$data, $params = '')
{
$results = doCurl(BASE_API_URL . 'shop/category/delete_category', $params, 'POST');
$json = json_decode(isset($results['output']) ? $results['output'] : NULL);
if (isset($json->status_code) && $json->status_code == Status_Code::GET_CATEGORY_CREATE_SUCCESS) {
$data['results'] = $json->results;
} else {
// $this->session->set_flashdata('error_message', $json->message);
$data['error_message'] = $json->message;
}
}
示例6: delete_product_package_unit
public function delete_product_package_unit(&$data, $params = '')
{
$results = doCurl(BASE_API_URL . 'delete/shop/product_package_unit', $params, 'POST');
// var_dump($results);exit();
$json = json_decode(isset($results['output']) ? $results['output'] : NULL);
if (isset($json->status_code) && $json->status_code == Status_Code::GET_CATEGORY_CREATE_SUCCESS) {
$data['results'] = $json->results;
} else {
// $this->session->set_flashdata('error_message', $json->message);
$data['error_message'] = $json->message;
}
}
示例7: create_shop
public function create_shop($params = '')
{
$results = doCurl(BASE_API_URL . 'create/shop/account', $params, 'POST');
var_dump($results);
exit;
$json = json_decode(isset($results['output']) ? $results['output'] : NULL);
if (isset($json->status_code) && $json->status_code == Status_Code::GET_CATEGORY_CREATE_SUCCESS) {
$data['results'] = $json->results;
} else {
// $this->session->set_flashdata('error_message', $json->message);
$data['error_message'] = $json->message;
}
}
示例8: get_json_wallofprayer
public function get_json_wallofprayer()
{
$data['results'] = 10;
$page = $this->input->post('page');
$data['page'] = $page ? $page : 1;
$get_all_prayer = doCurl(API_BASE_LINK . 'wallOfPrayer/get_all_prayer' . '?limit=' . $data['results'] . '&page=' . $data['page']);
if ($get_all_prayer && $get_all_prayer['http_status_code'] == 200) {
$content = json_decode($get_all_prayer['output']);
$status_code = $content->status_code;
if ($status_code == 200) {
$data['get_all_prayer_json'] = $content->results;
echo json_encode($data);
exit;
}
} else {
echo json_encode('error!');
exit;
}
}
示例9: checkForCaptions
function checkForCaptions($vId)
{
//$vId = "vsvSSGWSyxw";
$u = "http://video.google.com/timedtext?hl=en&v=" . $vId . "&type=list";
//echo $u;
$captions = doCurl($u);
$xml = simplexml_load_string($captions);
$json = json_encode($xml);
$array = json_decode($json, TRUE);
//var_dump ($array);
if (is_null($array["track"])) {
return null;
} else {
$captionfilename = $array["track"]["@attributes"]["name"];
//echo $captionfilename;
}
return $captionfilename;
//echo $captions;
}
示例10: create
public function create($value = '')
{
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$config['encrypt_name'] = TRUE;
$this->load->library('upload', $config);
if (!$this->upload->do_upload('upload')) {
$error = array('error' => $this->upload->display_errors());
var_dump($error);
} else {
$data = $this->upload->data();
$params['upload'] = new CURLFile($data['full_path']);
$results = doCurl(BASE_API_URL . 'shop/users/create', $params, 'POST');
var_dump($results);
exit;
}
}
示例11: edit
public function edit($project = false, $cbox = false)
{
$this->data['js'][] = 'http://www.rbg.vic.gov.au/dbpages/lib/ckeditor/ckeditor.js';
$this->output->enable_profiler(false);
if (!$project) {
redirect('projects');
}
if (!isset($this->session->userdata['id'])) {
redirect("projects/show/{$project}");
}
if ($this->input->post('submit')) {
$result = $this->projectservice->editProjectMetadata($this->input->post());
redirect("projects/show/{$result}");
}
if ($this->input->post('cancel')) {
redirect("projects/show/" . $project);
}
$this->data['project'] = json_decode(doCurl($this->ws_url() . 'ws/project_meta_get/' . $project, FALSE, TRUE));
$this->load->view('projects/edit', $this->data);
}
示例12: index
public function index()
{
if (!$this->session->userdata('access_token')) {
redirect('login', 'refresh');
} else {
$data = $this->tq_header_info();
$user_id = $this->session->userdata('user_id');
$results = doCurl(API_BASE_LINK . 'calendar/get_all_events_for_json?user_id=' . $user_id);
// var_dump($results);exit;
if (isset($results) && $results['http_status_code'] == 200) {
$content = json_decode($results['output']);
$results = $content->results;
$data['user_create_at'] = $results->user_create_at;
$data['spirituality'] = $results->spirituality;
$data['prayer_for_group'] = $results->prayer_for_group;
$data['prayer_for_urgent'] = $results->prayer_for_urgent;
}
$this->load->view('calendar/calendar_view', isset($data) ? $data : "");
}
}
示例13: getTaxaForState
private function getTaxaForState($state)
{
$params = array();
$params['fq'] = array();
$params['fq']['data_hub_uid'] = 'dh2';
$params['fq']['class'] = 'Equisetopsida';
$params['fq']['state'] = '"' . $state . '"';
$params['fq'][] = '(rank:species OR rank:subspecies OR rank:variety OR rank:form)';
$params['pageSize'] = 1;
$params['facets'] = 'taxon_name';
$params['flimit'] = 100000;
$query = createQueryString('biocache_search', $params);
$result = doCurl($query, FALSE, TRUE);
$data = json_decode($result);
$facets = $data->facetResults;
$taxa = array();
foreach ($facets[0]->fieldResult as $facet) {
$taxa[] = $facet->label;
}
return $taxa;
}
示例14: remove_alert_by_id
public function remove_alert_by_id()
{
$alert_id = $this->input->post('alert_id');
// echo json_encode($alert_id);exit;
$obj = array();
if (!empty($alert_id)) {
$results = doCurl(API_BASE_LINK . 'alert_messages/remove_alert_by_id?alert_id=' . $alert_id);
if ($results && $results['http_status_code'] == 200) {
$content = json_decode($results['output']);
$status_code = $content->status_code;
if ($status_code == 200) {
$obj['status'] = 200;
} else {
$obj['status'] = 400;
}
}
} else {
echo json_encode('error');
exit;
}
echo json_encode($obj);
exit;
}
示例15: del_photos
public function del_photos()
{
if (!$this->session->userdata('access_token')) {
redirect('login', 'refresh');
} else {
$data = $this->tq_admin_header_info();
$src_id = $this->input->post('src_id');
$admin_id = $this->session->userdata('admin_id');
$paths_src = $this->input->post('paths_src');
$result = doCurl(API_BASE_LINK . 'fellowship_life/del_photos?src_id=' . $src_id . '&admin_id=' . $admin_id);
$obj = array();
if ($result && $result['http_status_code'] == 200) {
$content = json_decode($result['output']);
$status_code = $content->status_code;
if ($status_code == 200) {
if (!empty($paths_src)) {
$paths_src = str_replace('\\', '/', $paths_src);
$paths_src = $data['role_path_albums'] . $paths_src;
// echo json_encode($paths_src);exit();
// echo json_encode(file_exists($paths_src));exit;
if (file_exists($paths_src)) {
!unlink($paths_src);
}
}
$obj['status'] = '200';
} else {
$obj['status'] = '400';
$obj['message'] = '异常错误!';
}
} else {
echo json_encode('error!');
exit;
}
echo json_encode($obj);
exit;
}
}