本文整理汇总了PHP中logit函数的典型用法代码示例。如果您正苦于以下问题:PHP logit函数的具体用法?PHP logit怎么用?PHP logit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了logit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: startthelog
function startthelog($logname, $quick = FALSE)
{
logit($logname, '-----------------------------------------------------------');
$line = '';
//logit($logname, $_SERVER['HTTP_REFERER']);
if (!$quick) {
// doing the dns lookup takes some extra time so use $quick to speed things up a bid
$line = gethostbyaddr($_SERVER["REMOTE_HOST"]);
if ($line == $_SERVER["REMOTE_ADDR"]) {
$line = '** No DNS entry found for calling IP';
}
$line = ' - ' . $line;
}
logit($logname, $_SERVER["REMOTE_ADDR"] . $line);
if (key_exists('HTTP_USER_AGENT', $_SERVER)) {
logit($logname, $_SERVER['HTTP_USER_AGENT'] . $line);
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (substr(str_replace(chr(10), '', print_r($_POST, true)), 10) == '') {
logit($logname, 'Called as a POST, but NO values were passed in');
} else {
logit($logname, 'POST values: ' . substr(str_replace(chr(10), '', print_r($_POST, true)), 10));
}
}
if ($_SERVER["QUERY_STRING"] != '') {
logit($logname, 'GET param string: ' . $_SERVER["QUERY_STRING"]);
}
}
开发者ID:kyukido22,项目名称:phplib,代码行数:28,代码来源:logitv2.php
示例2: SetSessionVals
function SetSessionVals($clientuserrecord, $PDOconn, $logname)
{
$cancontinue = TRUE;
//load client details
$_SESSION['clientdefaults']['clientid'] = $clientuserrecord->clientid;
$theq = 'select * from client where clientid=:clientid';
try {
$pdoquery = $PDOconn->prepare($theq);
$pdoquery->setFetchMode(PDO::FETCH_OBJ);
$pdoquery->execute(array('clientid' => $_SESSION["clientdefaults"]["clientid"]));
$client = $pdoquery->fetch();
} catch (PDOException $e) {
logit($logname, ' **ERROR** on line ' . __LINE__ . ' with query - ' . $theq . ' ' . $e->getMessage());
$cancontinue = FALSE;
}
if ($cancontinue) {
$_SESSION["clientdefaults"]["dbname"] = $client->dbname;
$_SESSION["clientdefaults"]["host"] = $client->host;
$_SESSION["clientdefaults"]["fullname"] = $client->fullname;
$_SESSION["clientdefaults"]["schoollogo"] = $client->schoollogo;
$_SESSION["clientdefaults"]["fedidprefix"] = $client->fedidprefix;
}
if ($cancontinue) {
$cancontinue = GetTheHTMLs($_SESSION["userlanguage"], $_SESSION["clientdefaults"]["clientid"], $PDOconn, $logname);
}
if ($cancontinue) {
header('Location: school.php');
}
return $cancontinue;
}
开发者ID:kyukido22,项目名称:nakaweb,代码行数:30,代码来源:clientselector.php
示例3: call_yql
/**
* Call the Yahoo Contact API
* @param string $consumer_key obtained when you registered your app
* @param string $consumer_secret obtained when you registered your app
* @param string $guid obtained from getacctok
* @param string $access_token obtained from getacctok
* @param string $access_token_secret obtained from getacctok
* @param bool $usePost use HTTP POST instead of GET
* @param bool $passOAuthInHeader pass the OAuth credentials in HTTP header
* @return response string with token or empty array on error
*/
function call_yql($consumer_key, $consumer_secret, $querynum, $access_token, $access_token_secret, $usePost = false, $passOAuthInHeader = true)
{
$retarr = array();
// return value
$response = array();
if ($querynum == 1) {
$url = 'http://query.yahooapis.com/v1/yql';
// Show my profile
$params['q'] = 'select * from social.profile where guid=me';
} elseif ($querynum == 2) {
$url = 'http://query.yahooapis.com/v1/yql';
// Find my friends
$params['q'] = 'select * from social.connections where owner_guid=me';
} else {
// Since this information is public, use the non oauth endpoint 'public'
$url = 'http://query.yahooapis.com/v1/public/yql';
// Find all sushi restaurants in SF order by number of ratings desc
$params['q'] = 'select Title,Address,Rating from local.search where query="sushi" and location="san francisco, ca"|sort(field="Rating.TotalRatings",descending="true")';
}
$params['format'] = 'json';
$params['callback'] = 'cbfunc';
$params['oauth_version'] = '1.0';
$params['oauth_nonce'] = mt_rand();
$params['oauth_timestamp'] = time();
$params['oauth_consumer_key'] = $consumer_key;
$params['oauth_token'] = $access_token;
// compute hmac-sha1 signature and add it to the params list
$params['oauth_signature_method'] = 'HMAC-SHA1';
$params['oauth_signature'] = oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $url, $params, $consumer_secret, $access_token_secret);
// Pass OAuth credentials in a separate header or in the query string
if ($passOAuthInHeader) {
$query_parameter_string = oauth_http_build_query($params, true);
$header = build_oauth_header($params, "yahooapis.com");
$headers[] = $header;
} else {
$query_parameter_string = oauth_http_build_query($params);
}
// POST or GET the request
if ($usePost) {
$request_url = $url;
logit("call_yql:INFO:request_url:{$request_url}");
logit("call_yql:INFO:post_body:{$query_parameter_string}");
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
$response = do_post($request_url, $query_parameter_string, 80, $headers);
} else {
$request_url = $url . ($query_parameter_string ? '?' . $query_parameter_string : '');
logit("call_yql:INFO:request_url:{$request_url}");
$response = do_get($request_url, 80, $headers);
}
// extract successful response
if (!empty($response)) {
list($info, $header, $body) = $response;
if ($body) {
logit("call_yql:INFO:response:");
print json_pretty_print($body);
}
$retarr = $response;
}
return $retarr;
}
开发者ID:S-Berhane,项目名称:oauth_yahoo,代码行数:71,代码来源:yql.php
示例4: log_activity
public function log_activity($user_id = null, $activity = '', $module = 'any')
{
if (!is_numeric($user_id) || empty($activity)) {
logit('Not enough information provided to insert activity.');
}
$data = array('user_id' => $user_id, 'activity' => $activity, 'module' => $module);
return parent::insert($data);
}
开发者ID:hnmurugan,项目名称:Bonfire,代码行数:8,代码来源:activity_model.php
示例5: update_from_feed
public function update_from_feed()
{
$xpath = "//a[contains(@href, \"mp3\")]";
$url = $this->main_url;
logit("Gathering ... {$url}");
logit("Xpath: {$xpath}");
$feed_contents = $this->read_feed($url);
$doc = new DOMDocument();
@$doc->loadHTML($feed_contents);
$dx = new DOMXPath($doc);
$entries = $dx->query($xpath);
$all_bayans = array();
$count = 0;
foreach ($entries as $entry) {
// if($count++ >= 40) return $all_bayans;
logit("Found: " . htmlentities($doc->saveXML($entry)));
$ps1 = $entry->previousSibling;
$ps2 = $ps1->previousSibling;
$ps3 = $ps2->previousSibling;
$ps4 = $ps3->previousSibling;
$ps5 = $ps4->previousSibling;
$ps6 = $ps5->previousSibling;
/*
logit(" -- ps1: " . htmlentities($doc->saveXML($ps1)));
logit(" -- ps2: " . htmlentities($doc->saveXML($ps2)));
logit(" -- ps3: " . htmlentities($doc->saveXML($ps3)));
logit(" -- ps4: " . htmlentities($doc->saveXML($ps4)));
logit(" -- ps5: " . htmlentities($doc->saveXML($ps5)));
logit(" -- ps6: " . htmlentities($doc->saveXML($ps6)));
*/
$ps4_dt = trim(strip_tags($ps4->nodeValue));
$ps6_dt = trim(strip_tags($ps6->nodeValue));
// check which format we have
if ($this->validate_date($ps4_dt)) {
// older format
$date_str = $this->convert_date($ps4_dt);
$title_str = trim(strip_tags($ps2->nodeValue));
} else {
if ($this->validate_date($ps6_dt)) {
// newer format
$date_str = $this->convert_date($ps6_dt);
$title_str = trim(strip_tags($ps4->nodeValue));
} else {
logit(" =====> ERROR: COULDN'T UNDERSTAND THE FORMAT");
continue;
}
}
$url_str = $this->prefix_to_url . $entry->getAttribute('href');
logit(" --- url: " . $url_str);
logit(" --- date: " . $date_str);
logit(" --- title: " . $title_str);
logit(" ------ ");
$bayan = array('url' => $url_str, 'title' => $title_str, 'uploaded_on' => $date_str);
$all_bayans[] = $bayan;
}
return $all_bayans;
}
开发者ID:bdunee,项目名称:bayyina,代码行数:57,代码来源:tasawwuf-org-full.php
示例6: callcontact
/**
* Call the Yahoo Contact API
* @param string $consumer_key obtained when you registered your app
* @param string $consumer_secret obtained when you registered your app
* @param string $guid obtained from getacctok
* @param string $access_token obtained from getacctok
* @param string $access_token_secret obtained from getacctok
* @param bool $usePost use HTTP POST instead of GET
* @param bool $passOAuthInHeader pass the OAuth credentials in HTTP header
* @return response string with token or empty array on error
*/
function callcontact($consumer_key, $consumer_secret, $guid, $access_token, $access_token_secret, $usePost = false, $passOAuthInHeader = true, $_count)
{
$retarr = array();
// return value
$response = array();
$url = 'http://social.yahooapis.com/v1/user/' . $guid . '/contacts?count=' . $_count;
$params['format'] = 'xml';
$params['view'] = 'compact';
$params['oauth_version'] = '1.0';
$params['oauth_nonce'] = mt_rand();
$params['oauth_timestamp'] = time();
$params['oauth_consumer_key'] = $consumer_key;
$params['oauth_token'] = $access_token;
// compute hmac-sha1 signature and add it to the params list
$params['oauth_signature_method'] = 'HMAC-SHA1';
//$params['oauth_signature'] =
// oauth_compute_hmac_sig($usePost? 'POST' : 'GET', $url, $params,
// $consumer_secret, $access_token_secret);
echo ',';
echo $params['oauth_nonce'];
echo ',';
echo $params['oauth_timestamp'];
echo ',';
echo oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $url, $params, $consumer_secret, $access_token_secret);
exit(0);
// Pass OAuth credentials in a separate header or in the query string
if ($passOAuthInHeader) {
$query_parameter_string = oauth_http_build_query($params, true);
$header = build_oauth_header($params, "yahooapis.com");
$headers[] = $header;
} else {
$query_parameter_string = oauth_http_build_query($params);
}
// POST or GET the request
if ($usePost && 0) {
$request_url = $url;
logit("callcontact:INFO:request_url:{$request_url}");
logit("callcontact:INFO:post_body:{$query_parameter_string}");
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
$response = do_post($request_url, $query_parameter_string, 80, $headers);
} else {
$request_url = $url . ($query_parameter_string ? '?' . $query_parameter_string : '');
logit("callcontact:INFO:request_url:{$request_url}");
$response = do_get($request_url, 80, $headers);
}
// extract successful response
if (!empty($response)) {
list($info, $header, $body) = $response;
if ($body) {
logit("callcontact:INFO:response:");
print json_pretty_print($body);
}
$retarr = $response;
}
return $retarr;
}
开发者ID:nitishpandey,项目名称:semiprecious,代码行数:67,代码来源:callcontact.php
示例7: activity_list
/**
* Displays the Activities for a module
*
* @param string $module Name of the module
* @param int $limit The number of activities to return
*
* @return string Displays the activities
*/
public function activity_list($module = null, $limit = 25)
{
if (empty($module)) {
logit('No module provided to `activity_list`.');
return;
}
$this->load->helper('date');
$activities = $this->activity_model->order_by('created_on', 'desc')->limit($limit, 0)->find_by_module($module);
$this->load->view('activity_list', array('activities' => $activities));
}
开发者ID:triasfahrudin,项目名称:siska21,代码行数:18,代码来源:activities.php
示例8: log_hit
function log_hit($status)
{
global $nolog, $logging;
if (!isset($nolog) && $status != '404') {
if ($logging == 'refer') {
logit('refer', $status);
} elseif ($logging == 'all') {
logit('', $status);
}
}
}
开发者ID:evanfarrar,项目名称:opensprints.org,代码行数:11,代码来源:log.php
示例9: refresh_access_token
/**
* Refresh an access token using an expired request token
* @param string $consumer_key obtained when you registered your app
* @param string $consumer_secret obtained when you registered your app
* @param string $old_access_token obtained previously
* @param string $old_token_secret obtained previously
* @param string $oauth_session_handle obtained previously
* @param bool $usePost use HTTP POST instead of GET (default false)
* @param bool $useHmacSha1Sig use HMAC-SHA1 signature (default false)
* @return response string with token or empty array on error
*/
function refresh_access_token($consumer_key, $consumer_secret, $old_access_token, $old_token_secret, $oauth_session_handle, $usePost = false, $useHmacSha1Sig = true, $passOAuthInHeader = true)
{
$retarr = array();
// return value
$response = array();
$url = 'https://api.login.yahoo.com/oauth/v2/get_token';
$params['oauth_version'] = '1.0';
$params['oauth_nonce'] = mt_rand();
$params['oauth_timestamp'] = time();
$params['oauth_consumer_key'] = $consumer_key;
$params['oauth_token'] = $old_access_token;
$params['oauth_session_handle'] = $oauth_session_handle;
// compute signature and add it to the params list
if ($useHmacSha1Sig) {
$params['oauth_signature_method'] = 'HMAC-SHA1';
$params['oauth_signature'] = oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $url, $params, $consumer_secret, $old_token_secret);
} else {
$params['oauth_signature_method'] = 'PLAINTEXT';
$params['oauth_signature'] = oauth_compute_plaintext_sig($consumer_secret, $old_token_secret);
}
// Pass OAuth credentials in a separate header or in the query string
if ($passOAuthInHeader) {
$query_parameter_string = oauth_http_build_query($params, true);
$header = build_oauth_header($params, "yahooapis.com");
$headers[] = $header;
} else {
$query_parameter_string = oauth_http_build_query($params);
}
// POST or GET the request
if ($usePost) {
$request_url = $url;
logit("refacctok:INFO:request_url:{$request_url}");
logit("refacctok:INFO:post_body:{$query_parameter_string}");
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
$response = do_post($request_url, $query_parameter_string, 443, $headers);
} else {
$request_url = $url . ($query_parameter_string ? '?' . $query_parameter_string : '');
logit("refacctok:INFO:request_url:{$request_url}");
$response = do_get($request_url, 443, $headers);
}
// extract successful response
if (!empty($response)) {
list($info, $header, $body) = $response;
$body_parsed = oauth_parse_str($body);
if (!empty($body_parsed)) {
logit("getacctok:INFO:response_body_parsed:");
print_r($body_parsed);
}
$retarr = $response;
$retarr[] = $body_parsed;
}
return $retarr;
}
开发者ID:nitishpandey,项目名称:semiprecious,代码行数:64,代码来源:refacctok.php
示例10: log_hit
/**
* Adds a row to the visitor logs.
*
* This function follows the site's logging preferences.
* If $logging preference is set to 'refer', only referrer
* hits are logged. If $logging is set to 'none' or '$nolog'
* global to TRUE, the function will ignore all hits.
*
* If the $status parameter is set to 404, the hit isn't logged.
*
* @param int $status HTTP status code
* @example
* log_hit(200);
*/
function log_hit($status)
{
global $nolog, $logging;
callback_event('log_hit');
if (!isset($nolog) && $status != 404) {
if ($logging == 'refer') {
logit('refer', $status);
} elseif ($logging == 'all') {
logit('', $status);
}
}
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:26,代码来源:log.php
示例11: write
function write($data, $log = true)
{
global $socket;
if (is_array($data)) {
$line = "PRIVMSG " . $data[0] . " :" . $data[1];
} else {
$line = $data;
}
logit("<<\t" . $line, $log);
if (!fwrite($socket, $line . "\n")) {
die("ERROR socket write\n");
}
}
开发者ID:robbiet480,项目名称:transmission-irc,代码行数:13,代码来源:transmission-irc.php
示例12: get_request_token
function get_request_token($callback = 'oob', $usePost = false, $useHmacSha1Sig = true, $passOAuthInHeader = false)
{
$retarr = array();
// return value
$response = array();
$params['oauth_version'] = '1.0';
$params['oauth_nonce'] = mt_rand();
$params['oauth_timestamp'] = time();
$params['oauth_consumer_key'] = $this->consumer_key;
$params['oauth_callback'] = $callback;
$headers = array();
// compute signature and add it to the params list
if ($useHmacSha1Sig) {
$params['oauth_signature_method'] = 'HMAC-SHA1';
$params['oauth_signature'] = oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $this->reqUrl, $params, $this->consumer_secret, null);
} else {
$params['oauth_signature_method'] = 'PLAINTEXT';
$params['oauth_signature'] = oauth_compute_plaintext_sig($this->consumer_secret, null);
}
// Pass OAuth credentials in a separate header or in the query string
if ($passOAuthInHeader) {
$query_parameter_string = oauth_http_build_query($params, true);
$header = build_oauth_header($params, "Twitter API");
$headers[] = $header;
} else {
$query_parameter_string = oauth_http_build_query($params);
}
// POST or GET the request
if ($usePost) {
$request_url = $this->reqUrl;
logit("getreqtok:INFO:request_url:{$request_url}");
logit("getreqtok:INFO:post_body:{$query_parameter_string}");
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
$response = do_post($request_url, $query_parameter_string, 80, $headers);
} else {
$request_url = $this->reqUrl . ($query_parameter_string ? '?' . $query_parameter_string : '');
logit("getreqtok:INFO:request_url:{$request_url}");
$response = do_get($request_url, 80, $headers);
}
// extract successful response
if (!empty($response)) {
list($info, $header, $body) = $response;
$body_parsed = oauth_parse_str($body);
if (!empty($body_parsed)) {
logit("getreqtok:INFO:response_body_parsed:");
}
$retarr = $response;
$retarr[] = $body_parsed;
}
return $retarr;
}
开发者ID:adadsa,项目名称:sosmed,代码行数:51,代码来源:library_helper.php
示例13: yim_checkinfo
function yim_checkinfo($username, $password, $return = array())
{
// Add to refresh token here
//Should check if session is valid
$oauth_data = array_key_exists('oauth_data', $_SESSION) ? $_SESSION['oauth_data'] : array();
$session_data = array_key_exists('session_data', $_SESSION) ? $_SESSION['session_data'] : array();
if (count($oauth_data) <= 0 || count($session_data) <= 0 || !yim_session_is_valid($oauth_data, $session_data)) {
$oauth_data = yim_login($username, $password);
$session_data = yim_create_session();
logit("PHP session active (" . session_id() . "). Created new Yahoo session with id: " . $session_data->sessionId . "\n\n");
} else {
logit("PHP session active (" . session_id() . "). Using Yahoo! session id: " . $session_data->sessionId . "\n\n");
}
return $session_data ? $session_data : false;
}
开发者ID:kontinuity,项目名称:ajaxim-yahoo-plugin,代码行数:15,代码来源:yim.php
示例14: find_by_module
public function find_by_module($modules = array())
{
if (empty($modules)) {
logit('No module name given to `find_by_module`.');
return false;
}
if (!is_array($modules)) {
$modules = array($modules);
}
foreach ($modules as $module) {
$this->db->or_where('module', $module);
}
$this->db->select('activity_id, activities.user_id, activity, module, activities.created_on, first_name, last_name, username, email, last_login');
$this->db->join('users', 'activities.user_id = users.id', 'left');
return $this->find_all();
}
开发者ID:nurulimamnotes,项目名称:Bonfire,代码行数:16,代码来源:activity_model.php
示例15: updatesysdef
function updatesysdef($key, $value, $dbconn, $logname)
{
try {
$theq = " delete from sysdef.system_defaults where sd_item=:key";
$pdoquery = $dbconn->prepare($theq);
$pdoquery->execute(array(":key" => $key));
$theq = " insert into sysdef.system_defaults (sd_value,sd_item)";
$theq .= " values (:value,:key)";
$pdoquery = $dbconn->prepare($theq);
$pdoquery->execute(array(":key" => $key, ":value" => $value));
} catch (PDOException $e) {
logit($logname, ' **ERROR** on line ' . __LINE__ . ' with query - ' . $theq . ' ' . $e->getMessage());
$results->errortext = $e->getMessage();
$cancontinue = FALSE;
}
}
开发者ID:kyukido22,项目名称:nakaweb,代码行数:16,代码来源:editschool.php
示例16: validate
function validate($params)
{
global $tikilib, $userlib, $known_hosts, $intertiki_errfile, $intertiki_logfile, $logslib;
$key = $params->getParam(0);
$key = $key->scalarval();
$login = $params->getParam(1);
$login = $login->scalarval();
$pass = $params->getParam(2);
$pass = $pass->scalarval();
$slave = $params->getParam(3);
$slave = $slave->scalarval();
if (!isset($known_hosts[$key]) or $known_hosts[$key]['ip'] != $_SERVER['REMOTE_ADDR']) {
$msg = tra('Invalid server key');
if ($intertiki_errfile) {
logit($intertiki_errfile, $msg, $key, INTERTIKI_BADKEY, $known_hosts[$key]['name']);
}
$logslib->add_log('intertiki', $msg . ' from ' . $known_hosts[$key]['name'], $login);
return new XML_RPC_Response(0, 101, $msg);
}
if (!$userlib->validate_user($login, $pass, '', '')) {
$msg = tra('Invalid username or password');
if ($intertiki_errfile) {
logit($intertiki_errfile, $msg, $login, INTERTIKI_BADUSER, $known_hosts[$key]['name']);
}
$logslib->add_log('intertiki', $msg . ' from ' . $known_hosts[$key]['name'], $login);
if (!$userlib->user_exists($login)) {
// slave client is supposed to disguise 102 code as 101 not to show
// crackers that user does not exists. 102 is required for telling slave
// to delete user there
return new XML_RPC_Response(0, 102, $msg);
} else {
return new XML_RPC_Response(0, 101, $msg);
}
}
if ($intertiki_logfile) {
logit($intertiki_logfile, "logged", $login, INTERTIKI_OK, $known_hosts[$key]['name']);
}
if ($slave) {
$logslib->add_log('intertiki', 'auth granted from ' . $known_hosts[$key]['name'], $login);
global $userlib;
$user_details = $userlib->get_user_details($login);
return new XML_RPC_Response(new XML_RPC_Value(serialize($user_details), "string"));
} else {
$logslib->add_log('intertiki', 'auth granted from ' . $known_hosts[$key]['name'], $login);
return new XML_RPC_Response(new XML_RPC_Value(1, "boolean"));
}
}
开发者ID:noikiy,项目名称:owaspbwa,代码行数:47,代码来源:remote.php
示例17: post_tweet
/**
* Call twitter to post a tweet
* @param string $consumer_key obtained when you registered your app
* @param string $consumer_secret obtained when you registered your app
* @param string $status_message
* @param string $access_token obtained from get_request_token
* @param string $access_token_secret obtained from get_request_token
* @param bool $usePost use HTTP POST instead of GET
* @param bool $passOAuthInHeader pass OAuth credentials in HTTP header
* @return response string or empty array on error
*/
function post_tweet($consumer_key, $consumer_secret, $status_message, $access_token, $access_token_secret, $usePost = false, $passOAuthInHeader = true)
{
$retarr = array();
// return value
$response = array();
//$url = 'http://api.twitter.com/1/statuses/update.json';
$url = 'http://api.twitter.com/1.1/friendships/incoming.json';
//$params['status'] = $status_message;
$params['oauth_version'] = '1.0';
$params['oauth_nonce'] = mt_rand();
$params['oauth_timestamp'] = time();
$params['oauth_consumer_key'] = $consumer_key;
$params['oauth_token'] = $access_token;
// compute hmac-sha1 signature and add it to the params list
$params['oauth_signature_method'] = 'HMAC-SHA1';
$params['oauth_signature'] = oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $url, $params, $consumer_secret, $access_token_secret);
// Pass OAuth credentials in a separate header or in the query string
if ($passOAuthInHeader) {
$query_parameter_string = oauth_http_build_query($params, true);
$header = build_oauth_header($params, "Twitter API");
$headers[] = $header;
} else {
$query_parameter_string = oauth_http_build_query($params);
}
// POST or GET the request
if ($usePost) {
$request_url = $url;
logit("tweet:INFO:request_url:{$request_url}");
logit("tweet:INFO:post_body:{$query_parameter_string}");
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
$response = do_post($request_url, $query_parameter_string, 80, $headers);
} else {
$request_url = $url . ($query_parameter_string ? '?' . $query_parameter_string : '');
logit("tweet:INFO:request_url:{$request_url}");
$response = do_get($request_url, 80, $headers);
}
// extract successful response
if (!empty($response)) {
list($info, $header, $body) = $response;
if ($body) {
logit("tweet:INFO:response:");
print json_pretty_print($body);
}
$retarr = $response;
}
return $retarr;
}
开发者ID:0x27,项目名称:mrw-code,代码行数:58,代码来源:getfollowrequests.php
示例18: command
function command($param = "", $log = "")
{
$out = false;
if ($line = exec("transmission-remote " . $param, $out)) {
if (count($out) > 1) {
$res = rtrim($out[0]);
} else {
if (preg_match("/\"(.+)\"/", $line, $reg)) {
$res = $reg[1];
}
}
if ($log !== false) {
logit($param, !empty($res) ? $res : "", $log);
}
}
return $out;
}
开发者ID:robbiet480,项目名称:transmission-irc,代码行数:17,代码来源:transmission-remote.php
示例19: postcontact
/**
* Call the Yahoo Contact API
* @param string $consumer_key obtained when you registered your app
* @param string $consumer_secret obtained when you registered your app
* @param string $guid obtained from getacctok
* @param string $access_token obtained from getacctok
* @param string $access_token_secret obtained from getacctok
* @param bool $usePost use HTTP POST instead of GET
* @param bool $passOAuthInHeader pass the OAuth credentials in HTTP header
* @return response string with token or empty array on error
*/
function postcontact($consumer_key, $consumer_secret, $guid, $access_token, $access_token_secret, $usePost = false, $passOAuthInHeader = true)
{
$retarr = array();
// return value
$response = array();
$post_body = '{"contact":{"fields":[{"type":"name","value":{"givenName":"John","middleName":"","familyName":"Doe","prefix":"","suffix":"","givenNameSound":"","familyNameSound":""}},{"type":"email","value":"[email protected]"}]}}';
$url = 'http://social.yahooapis.com/v1/user/' . $guid . '/contacts';
$params['oauth_version'] = '1.0';
$params['oauth_nonce'] = mt_rand();
$params['oauth_timestamp'] = time();
$params['oauth_consumer_key'] = $consumer_key;
$params['oauth_token'] = $access_token;
// compute hmac-sha1 signature and add it to the params list
$params['oauth_signature_method'] = 'HMAC-SHA1';
$params['oauth_signature'] = oauth_compute_hmac_sig($usePost ? 'POST' : 'GET', $url, $params, $consumer_secret, $access_token_secret);
// Pass OAuth credentials in a separate header or in the query string
if ($passOAuthInHeader) {
$query_parameter_string = oauth_http_build_query($params, true);
$header = build_oauth_header($params, "yahooapis.com");
$headers[] = $header;
$request_url = $url;
} else {
$query_parameter_string = oauth_http_build_query($params);
$request_url = $url . '?' . $query_parameter_string;
}
// POST or GET the request
if ($usePost) {
logit("postcontact:INFO:request_url:{$request_url}");
logit("postcontact:INFO:post_body:{$post_body}");
$headers[] = 'Content-Type: application/json';
$response = do_post($request_url, $post_body, 80, $headers);
} else {
logit("postcontact:INFO:request_url:{$request_url}");
$response = do_get($request_url, 80, $headers);
}
// extract successful response
if (!empty($response)) {
list($info, $header, $body) = $response;
if ($body) {
logit("postcontact:INFO:response:");
print json_pretty_print($body);
}
$retarr = $response;
}
return $retarr;
}
开发者ID:S-Berhane,项目名称:oauth_yahoo,代码行数:57,代码来源:postcontact.php
示例20: getFilePath
function getFilePath($rawFilePath, $caller)
{
include '../../_paths.php';
logit($caller, "getFilePath:" . $rawFilePath);
if ($rawFilePath == "''" || $rawFilePath == "") {
return $rawFilePath;
}
$path_info = pathinfo($rawFilePath);
$fileExtension = $path_info['extension'];
// get file extension
logit($caller, "File Extension:" . $fileExtension);
if ($fileExtension == "flv" || $fileExtension == "f4v") {
$rawFilePath = $videoRootPath . $rawFilePath;
logit($caller, "Regular Video file extension:" . $fileExtension . ". Returning path:" . $rawFilePath);
} else {
logit($caller, "Non video file extension:" . $fileExtension . ". Returning same path");
}
return $rawFilePath;
}
开发者ID:aview,项目名称:aview-content-php,代码行数:19,代码来源:checkfiles.php
注:本文中的logit函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论