本文整理汇总了PHP中getResults函数的典型用法代码示例。如果您正苦于以下问题:PHP getResults函数的具体用法?PHP getResults怎么用?PHP getResults使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getResults函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isIndexed
function isIndexed($t)
{
$query = $t->getText() . " site:wikihow.com";
$url = "http://www.google.com/search?q=" . urlencode($query) . "&num=100";
#echo "using {$t->getText()} - $url\n";
$results = getResults($url);
if ($results == null) {
return null;
}
$doc = new DOMDocument('1.0', 'utf-8');
$doc->formatOutput = true;
$doc->strictErrorChecking = false;
$doc->recover = true;
@$doc->loadHTML($results);
$xpath = new DOMXPath($doc);
$nodes = $xpath->query('//a[contains(concat(" ", normalize-space(@class), " "), " l")]');
$index = 1;
$turl = urldecode($t->getFullURL());
foreach ($nodes as $node) {
$href = $node->getAttribute("href");
#echo "{$title->getFullURL()}, {$href}\n";
#if (preg_match("@/url?q=" . $title->getFullURL() . "@", $href))
if ($href == $turl) {
$found[] = $title;
return $index;
}
$index++;
}
return 0;
}
示例2: displaySearchResults
function displaySearchResults()
{
if (isset($_GET["auto"])) {
return outputResults(getResults(generateAutoSearchUrl()));
} else {
return outputResults(getResults(getSearchRequest()));
}
}
示例3: getExport
function getExport()
{
$results = getResults();
if (isset($_GET['type']) && $_GET['type'] == VCAL) {
return new VCalExport($results);
} else {
return new ICalExport($results);
}
}
示例4: getPageViews
function getPageViews($slug)
{
global $analytics, $profile;
$results = getResults($analytics, $profile, $slug);
if (count($results->getRows()) < 1) {
return;
}
$profileName = $results->getProfileInfo()->getProfileName();
$rows = $results->getRows();
$views = $rows[0][1];
return $views;
}
示例5: runMainDemo
function runMainDemo(&$analytics)
{
try {
// Step 2. Get the user's first view (profile) ID.
$profileId = GOOGLE_ANALYTICS_PROFILE_ID;
if (isset($profileId)) {
// Step 3. Query the Core Reporting API.
$results = getResults($analytics, $profileId);
// Step 4. Output the results.
printResults($results);
}
} catch (apiServiceException $e) {
// Error from the API.
print 'There was an API error : ' . $e->getCode() . ' : ' . $e->getMessage();
} catch (Exception $e) {
print 'There was a general error : ' . $e->getMessage();
}
}
示例6: search
function search($title, $site = "")
{
global $notfound, $found;
#$urls = split("\n", $q);
$query = $title->getText() . " {$site}";
$url = "http://www.google.com/search?q=" . urlencode($query) . "&num=100";
$results = getResults($url);
if ($results == null) {
return -2;
}
$doc = new DOMDocument('1.0', 'utf-8');
$doc->formatOutput = true;
$doc->strictErrorChecking = false;
$doc->recover = true;
@$doc->loadHTML($results);
$xpath = new DOMXPath($doc);
$nodes = $xpath->query("//div[@class='vresult']");
$index = 1;
$turl = "http://www.wikihow.com/" . urldecode($title->getPrefixedURL());
foreach ($nodes as $node) {
$links = $xpath->query(".//a[@class='l']", $node);
foreach ($links as $link) {
$href = $link->getAttribute("href");
#echo "$href\n";
#echo "+++{$doc->saveXML($link)}\n";
if ($href == $turl) {
$found[] = $title;
return $index;
}
$index++;
}
}
#echo str_replace("<", "\n<", $doc->saveXML()); exit;
$notfound[] = $title;
return -1;
}
示例7: date
$current_time = date("Y-m-d H:i:s", time());
printf("\ncurrent time: %s. script for: %s\n", $current_time, $yesterday);
$dbconnection = new mysqlconnect();
$dbconnection->connect($dbName);
$mysqli = $dbconnection->connection;
$insertquery = "insert into mz_sessioncount(record_date, metric) values (?, ?) on duplicate key update \n record_date=values(record_date), metric=values(metric)";
if ($stmt = $mysqli->prepare($insertquery)) {
$stmt->bind_param("si", $datetime, $metric);
$mysqli->query("start");
} else {
printf("error: %s\n", $mysqli->error);
}
$analytics = getService();
//$profile = getFirstProfileId($analytics);
$profile = '8515';
$sessioncount = getResults($analytics, $profile);
if (count($sessioncount->getRows()) > 0) {
$rowCount = count($sessioncount->getRows());
$rows = $sessioncount->getRows();
//print_r($rows);
for ($i = 0; $i < $rowCount; $i++) {
$datetime = date('Y-m-d', strtotime($rows[$i][0]));
$metric = $rows[$i][1];
$stmt->execute();
printf("date: %s, counts: %d.\n", $datetime, $metric);
}
}
$stmt->close();
$mysqli->query("done");
$dbconnection->dbclose();
function getService()
示例8: getExpert
<?php
if (isset($_GET["expert"])) {
$expertName = $_GET["expert"];
$expert = getExpert($expertName);
$expert = $expert->speaker;
} else {
$experts = array();
$currPage = isset($_GET["p"]) ? $_GET["p"] : 1;
$keyword = isset($_GET["q"]) ? $_GET["q"] : "";
$availability = isset($_GET["a"]) ? $_GET["a"] : "";
$industry = isset($_GET["i"]) ? $_GET["i"] : "";
$sort = isset($_GET["s"]) ? $_GET["s"] : "name";
$pagesize = isset($_GET["n"]) ? $_GET["n"] : 10;
$responseData = getResults($currPage, $keyword, $availability, $industry, $sort, $pagesize);
$filters = getFilter($currPage, $keyword, $availability, $industry, $sort, $pagesize);
$pagination = buildPagination($currPage, $responseData->total, $pagesize);
$searchDetail = getSearchInfo($currPage, $responseData->total, $pagesize);
$filterArray = array();
if ($sort !== 'name') {
$filterArray[] = 's=' . $sort;
}
if ($pagesize !== 10) {
$filterArray[] = 'n=' . $pagesize;
}
if (!empty($filterArray)) {
$filterString = implode('&', $filterArray);
}
$filter_availability = $availability;
$filter_industry = $industry;
$filter_keyword = $keyword;
示例9: getResults
function getResults(&$analytics, $profileId)
{
// Calls the Core Reporting API and queries for the number of sessions
// for the last seven days.
return $analytics->data_ga->get('ga:' . $profileId, '7daysAgo', 'today', 'ga:sessions');
}
/*function printResults(&$results) {
// Parses the response from the Core Reporting API and prints
// the profile name and total sessions.
if (count($results->getRows()) > 0) {
// Get the profile name.
$profileName = $results->getProfileInfo()->getProfileName();
// Get the entry for the first entry in the first row.
$rows = $results->getRows();
$sessions = $rows[0][0];
// Print the results.
print "First view (profile) found: $profileName\n";
print "Total sessions: $sessions\n";
} else {
print "No results found.\n";
}
}
*/
$analytics = getService();
//$profile = getFirstProfileId($analytics);
$profile = '8515';
$outcome = getResults($analytics, $profile);
var_dump($outcome);
示例10: aeg
<br><br>
<input type="submit" name="create" value="Salvesta">
</form>
<br><br>
<h3>Eelnevad jooksud:</h3>
<table border=1 >
<tr>
<th>id</th>
<th>kasutaja id</th>
<th>Jooksu pikkus</th>
<th>Jooksu aeg(H)</th>
<th>Rada</th>
<th>Kuupäev</th>
</tr>
<?php
$result_list = getResults();
?>
<?php
// iga massiivis olema elemendi kohta
// count($car_list) - massiivi pikkus
for ($i = 0; $i < count($result_list); $i++) {
// $i = $i +1; sama mis $i += 1; sama mis $i++;
//kui on see rida mida kasutaja tahab muuta siis kuvan input väljad
if (isset($_GET["edit"]) && $result_list[$i]->id == $_GET["edit"]) {
// kasutajale muutmiseks
echo "<tr>";
echo "<form action='table.php' method='post'>";
echo "<td>" . $result_list[$i]->id . "</td>";
echo "<td>" . $result_list[$i]->user_id . "</td>";
echo "<td><input name='time' value='" . $result_list[$i]->time . "'></td>";
示例11: json_decode
// if authenticated, get users list of access groups
$_SESSION['loggedIn'] = "Y";
// login user
$_SESSION['username'] = $data['username'];
$_SESSION['userGroups'] = json_decode($userGroups);
}
return $auth;
}
function logout()
{
session_destroy();
return true;
}
if ($call == 'getResults') {
// adaptor to run corresponding functions
print_r(getResults($data));
} else {
if ($call == 'getMetadataFieldList') {
print_r(getMetadataFieldList());
} else {
if ($call == 'getAclList') {
print_r(getAclList($data));
} else {
if ($call == 'login') {
print_r(login($data));
} else {
if ($call == 'logout') {
print_r(logout());
} else {
if ($call == 'checkLogin') {
print_r(checkLogin());
示例12: google_login
public function google_login()
{
require_once APPPATH . 'libraries/google-api-php-client/src/Google/autoload.php';
//$this->load->model('users_model');
//$redirect = isEmpty($this->input->get('referuri'))?'':$this->input->get('referuri');
$data = array();
//echo 'test';
// Start a session to persist credentials.
//session_start();
//echo BASEPATH;
//var_dump(is_file(APPPATH.'libraries/google-api-php-client/client_secrets.json'));
//exit('test');
// Create the client object and set the authorization configuration
// from the client_secrets.json you downloaded from the Developers Console.
$client = new Google_Client();
$client->setAuthConfigFile(APPPATH . 'libraries/google-api-php-client/client_secrets.json');
//$client->setRedirectUri(base_url('login/google_callback'));
$client->setScopes('email');
$client->addScope(Google_Service_Analytics::ANALYTICS_READONLY);
// If the user has already authorized this app then get an access token
// else redirect to ask the user to authorize access to Google Analytics.
if ($this->session->userdata('access_token') != '') {
// Set the access token on the client.
$client->setAccessToken($this->session->userdata('access_token'));
// Create an authorized analytics service object.
$analytics = new Google_Service_Analytics($client);
// Get the first view (profile) id for the authorized user.
$profile = getFirstProfileId($analytics);
// Get the results from the Core Reporting API and print the results.
printResults(getResults($analytics, $profile));
} else {
$redirect_uri = base_url('login/google_callback');
//header('Location: ' . filter_var($redirect_uri, FILTER_SANITIZE_URL));
redirect(filter_var($redirect_uri, FILTER_SANITIZE_URL));
}
}
示例13: action_user_login
public function action_user_login($nationalId, $password)
{
$users = getResults(DB::query('select * from users where national_id = ? and upassword = ?', array($nationalId, $password)));
if (count($users) == 1) {
return response(array('user' => $users, 'operation' => 'login'));
}
return response(array('user' => array(), 'operation' => 'login'));
}
示例14: date
$profile = $gaprofile::makezine;
$today = date("Y-m-d", time());
$dbconnection = new mysqlconnect();
$dbconnection->connect($dbName);
$mysqli = $dbconnection->connection;
$insertquery = "insert into mz_pv(statdate, pageviews, sessions, users, newusers) values (?,?,?,?,?)";
if ($stmt = $mysqli->prepare($insertquery)) {
$stmt->bind_param("siiii", $statdate, $pageviews, $sessions, $users, $newusers);
$mysqli->query("start");
} else {
printf("error: %s\n", $mysqli->error);
}
$analytics = getService();
//$profile = getFirstProfileId($analytics);
$profile = '8515';
$mzmetrics = getResults($analytics, $profile);
if (count($mzmetrics->getRows()) > 0) {
$rowCount = count($mzmetrics->getRows());
$rows = $mzmetrics->getRows();
//print_r($rows);
for ($i = 0; $i < $rowCount; $i++) {
$statdate = date('Y-m-d', strtotime($rows[$i][0]));
$pageviews = $rows[$i][1];
$sessions = $rows[$i][2];
$users = $rows[$i][3];
$newusers = $rows[$i][4];
$stmt->execute();
printf("date: %s, pageviews: %d.\n", $statdate, $pageviews);
}
}
$stmt->close();
示例15: error_reporting
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>测试curl</title>
</head>
<body>
<?php
error_reporting(E_ALL && ~E_NOTICE);
//获取图片数据
$url = "http://api.hdtv.letv.com/iptv/api/box/getNavigator.json?type=1";
$datas = getResults($url);
$response = $datas['response'];
$response = array_reverse($response);
echo "<pre>";
print_r($response);
echo "</pre>";
function getResults($url)
{
$return = '';
if ($url) {
//初始化一个对象
$curl = curl_init();
//设置要抓取的url
curl_setopt($curl, CURLOPT_URL, $url);
//设置header
//curl_setopt($curl,CURLOPT_HEADER,1);
//设置cURL 参数,要求结果保存到字符串中还是输出到屏幕上。
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
//设置超时时间只需要设置一个秒的数量就可以
curl_setopt($ch, CURLOPT_TIMEOUT, 20);