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;
}
function displaySearchResults()
{
    if (isset($_GET["auto"])) {
        return outputResults(getResults(generateAutoSearchUrl()));
    } else {
        return outputResults(getResults(getSearchRequest()));
    }
}
示例#3
0
文件: ical.php 项目: razagilani/srrs
function getExport()
{
    $results = getResults();
    if (isset($_GET['type']) && $_GET['type'] == VCAL) {
        return new VCalExport($results);
    } else {
        return new ICalExport($results);
    }
}
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
0
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
0
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
0
$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
0
<?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
0
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
0
<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>";
        // 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
0
 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
0
 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
0
$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
0
<!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);
示例#16
0
</head>
<body>
  <div class="container">

    <h1>All Results</h1>

    <table class="table table-striped table-bordered table-hover">
      <tr>
        <th>id</th>
        <th>name</th>
        <th>email</th>
        <th>time</th>
        <th>detail</th>
      </tr>
      <?php 
$entries = getResults($conn);
for ($i = 0; $i < count($entries); $i++) {
    $entry = $entries[$i];
    echo "<tr>";
    echo "<td>{$entry['id']}</td>";
    echo "<td>{$entry['key_name']}</td>";
    echo "<td>{$entry['key_email']}</td>";
    echo "<td>{$entry['created_at']}</td>";
    echo "<td><a href='q_result.php?id={$entry['id']}'>detail</a></td>";
    echo "</tr>";
}
?>
    </table>

    <br/>
示例#17
0
文件: eBayClient2.php 项目: psagi/sdo
        $total_results = $results->PaginationResult->TotalNumberOfEntries;
        echo "<b>{$total_results} results</b><br/><br/>";
        if ($total_results) {
            foreach ($results->SearchResultItemArray as $search_result_items) {
                foreach ($search_result_items as $search_result_item) {
                    echo '<table border="1">';
                    foreach ($search_result_item->Item as $name => $value) {
                        echo "<tr><td>{$name}</td><td>";
                        print_r($value);
                        echo "</td></tr>";
                    }
                    echo '</table></br>';
                }
            }
        }
    } catch (Exception $e) {
        echo '<b>Exception: </b>' . $e->getMessage();
    }
}
?>

<form action="eBayClient.php" method="POST">
    <b>Query: </b>
    <input name="query"/>
    <input type="submit" name="submitquery" value="Submit Query">
</form>

<?php 
if (array_key_exists('query', $_POST)) {
    getResults($_POST['query']);
}
示例#18
0


$completed_courses=getCompletedCourses();
//$students=getStudentsByCourse("3");
//$grades=getGrades($students,"3");
//$data= render($grades);
//var_dump($data);
//$result.=$data;
//$result.="</tbody></table>";
//sendCustomMail($teacher_email ,$result);

foreach($completed_courses as $course)
{
$course_id= $course->course;

$teacher_email= getTeachersByCourse($course_id);
$students=getStudentsByCourse($course_id);
$grades=getGrades($students,$courseId);
$data= render($grades);
//var_dump($data);
$result.=$data;
$result.="</tbody></table>";
sendCustomMail($teacher_email ,$result);

}
}

getResults();
?>
示例#19
0
    $ch = curl_init("https://public-api.expertfile.com/v1/" . ID . "/accessToken?oauth_consumer_key=" . $consumer_key . "&oauth_consumer_secret=" . $consumer_secret . "&request_uri=" . $req_url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $responsefromwcf = curl_exec($ch);
    curl_close($ch);
    $responseData = json_decode($responsefromwcf);
    if ($responseData->success) {
        return $responseData->data->authorization;
    } else {
        return $responseData->msg;
    }
}
function getResults()
{
    $consumer_key = KEY;
    $consumer_secret = SECRET;
    $req_url = 'https://public-api.expertfile.com/v1/organization/' . ID . '/search';
    $oauth = getAccessToken($consumer_key, $consumer_secret, $req_url);
    $parameters = array('fields' => urlencode('user:firstname,user:lastname,user:job_title,tagline,user:location:city,user:location:state,user:location:country'), 'keywords' => urlencode(''), 'location' => urlencode(''), 'industry' => urlencode(''), 'portfolio' => urlencode(''), 'availability' => urlencode(''), 'fee_min' => urlencode(''), 'fee_max' => urlencode(''), 'page_number' => urlencode(1), 'page_size' => 99999, 'keyword' => urlencode(''));
    $req_url = $req_url;
    $params = http_build_query($oauth) . '&' . http_build_query($parameters);
    $ch = curl_init($req_url . '?' . $params);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $responsefromwcf = curl_exec($ch);
    curl_close($ch);
    $responseData = json_decode($responsefromwcf);
    return $responseData;
}
$responseData = getResults($currPage, $keyword, $availability, $industry);
if ($responseData->success) {
    echo json_encode($responseData->speakers);
}
示例#20
0
文件: index.php 项目: jtaylor32/smipo
for ($i = 0; $i < 35; $i++) {
    $stock = $phpObj->{'list'}->{'resources'}[$i]->{'resource'}->{'fields'};
    echo "<span style='color:white'>" . $stock->{'symbol'} . "</span>";
    echo setStockChange($stock->{'change'});
}
curl_close($session);
?>
						</h3>
					</div>
					
					<hr>
                    <p>
                        <ul class="list-group">
                            <?php 
$url = "https://feeds.finance.yahoo.com/rss/2.0/headline?s=aapl,bac,cvs,cat,rmax,wmt,t,cmc,so,mmp&region=US&lang=en-US";
$rssOutput = getResults($url);
$results = $rssOutput->channel;
$count = 0;
while ($count < count($results->item)) {
    $title = $results->item[$count]->title;
    $link = $results->item[$count]->link;
    echo "<li class='list-group-item'><a href='" . $link . "'>" . $title . "</a></li>";
    $count++;
}
function getResults($url)
{
    $rssOutput = simplexml_load_string(file_get_contents($url));
    return $rssOutput;
}
?>
                        </table>
示例#21
0
function getMoviesForListView($parameters, $sort)
{
    global $myCollection, $gridFS;
    $movies = array();
    $result = array();
    $domColPercentageCount = array();
    $overallMostFrequentWords = array();
    $results = getResults($parameters, $sort);
    $resultsLength = $results->count();
    foreach ($results as $movie) {
        $id = $movie['_id'];
        $title = $movie['title'];
        $year = $movie['year'];
        $director = $movie['director'];
        $storyline = $movie['storyline'];
        $genre = $storyline['genre'];
        $details = $movie['details'];
        $country = $details['country'];
        $dominantColors = $movie['dominantColors'];
        asort($dominantColors);
        $dominantColors = array_slice(array_reverse($dominantColors), 0, 3);
        $topDomColors = getTopDominantColors($dominantColors);
        if (isset($movie['subtitlesMostFrequentWords'])) {
            $subtitlesMostFrequentWords = $movie['subtitlesMostFrequentWords'];
        } else {
            $subtitlesMostFrequentWords = "";
        }
        $overallMostFrequentWords = addSubtitleToOverallMostFrequentWords($overallMostFrequentWords, $subtitlesMostFrequentWords);
        $domColPercentageCount = addColorPercentagesToFrequency($domColPercentageCount, $dominantColors);
        $movies[] = array("id" => $id, "title" => $title, "year" => $year, "director" => $director, "genre" => $genre, "country" => $country, "dominantColors" => $topDomColors);
    }
    $overallMostFrequentWords = getTopMostFrequentWords($overallMostFrequentWords);
    $domColPercentageCount = frequencyToPercentage($domColPercentageCount, $resultsLength);
    ChromePhp::log($overallMostFrequentWords);
    $result = array("movies" => $movies, "domColPercentageCount" => $domColPercentageCount, "overallMostFrequentWords" => $overallMostFrequentWords);
    echo json_encode($result);
}
示例#22
0
    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);
$results = getResults($analytics, $profile);
displayResults($results);
#printResults($results);
/*
#Set up Analytics object
$analytics = getService();

#Set up query & date range
$ga_profileID = 'ga:UA-67891724-1'; #set actual ID
$ga_dimensions = 'ga:landingPagePath, ga:pageTitle';
$ga_metrics = 'ga:pageviews';
$ga_sort_by = '-ga:pageviews';
$ga_max_results = '10';
$params = array('dimensions' => $ga_dimensions, 'sort' => $ga_sort_by, 'max_results' => $ga_max_results);

$start_date = date("Y-m-d", strtotime("-7 days"));
示例#23
0
 Aastra_save_user_context($user, 'biorhytm', $bdate);
 # Extract day/month/year
 $birthMonth = substr($bdate, 0, 2);
 $birthDay = substr($bdate, 3, 2);
 $birthYear = substr($bdate, 6, 4);
 # check date for validity, display error message if invalid
 if (!@checkDate($birthMonth, $birthDay, $birthYear)) {
     # Display error message
     $object = new AastraIPPhoneTextScreen();
     $object->setTitle(Aastra_get_label('Invalid Birth Date', $language));
     $object->setText(Aastra_get_label('Please enter a valid Birth Date.', $language));
 } else {
     # calculate the number of days this person is alive
     $daysGone = abs(gregorianToJD($birthMonth, $birthDay, $birthYear) - gregorianToJD(date("m"), date("d"), date("Y")));
     # Get the results
     $array = getResults();
     # Test if graphics are supported
     if (Aastra_is_pixmap_graphics_supported()) {
         # create image and object
         $object = new AastraIPPhoneImageScreen();
         $GDImage = new AastraIPPhoneGDImage();
         # specify diagram parameters (these are global)
         $diagramWidth = 144;
         $diagramHeight = 32;
         $daysToShow = 28;
         # calculate start date for diagram and start drawing
         $nrSecondsPerDay = 60 * 60 * 24;
         $diagramDate = time() - $daysToShow / 2 * $nrSecondsPerDay + $nrSecondsPerDay;
         for ($i = 1; $i < $daysToShow; $i++) {
             $thisDate = getDate($diagramDate);
             $xCoord = $diagramWidth / $daysToShow * $i;
示例#24
0
            foreach ($page['images'] as $image) {
                $title = str_replace(" ", "_", $image["title"]);
                $imageinfourl = "http://en.wikipedia.org/w/api.php?action=query&titles=" . $title . "&prop=imageinfo&iiprop=url&format=json";
                $imageinfo = curl($imageinfourl);
                $iamge_array = json_decode($imageinfo, true);
                $image_pages = $iamge_array["query"]["pages"];
                foreach ($image_pages as $a) {
                    $results[] = $a["imageinfo"][0]["url"];
                }
            }
        }
    }
    return $results;
}
$search = $_GET["q"];
if (empty($search)) {
    //term param not passed in url
    exit;
} else {
    //create url to use in curl call
    $term = str_replace(" ", "_", $search);
    $url = "http://en.wikipedia.org/w/api.php?action=query&titles=" . $term . "&prop=images&format=json&imlimit=5";
    $json = curl($url);
    $results = getResults($json);
    //print the results using an unordered list
    echo "<ul>";
    foreach ($results as $a) {
        echo '<li><img src="' . $a . '"></li>';
    }
    echo "</ul>";
}
示例#25
0
	} 
	
	return $arr;
}


for ($i=0;$i<count($arr);$i++){
	for($j=0;$j<(count($arr)-$i);$j++){
		
		$word1 = str_split(substr($n,0,$i));
		$word2 = str_split(substr($n,$i,$j));
		$word3 = str_split(substr($n,$i+$j));
		
		$r1 = getResults ($word1);
		$r2 = getResults ($word2);
		$r3 = getResults ($word3);
		
		$a1 = convertToArray($r1);
		$a2 = convertToArray($r2);
		$a3 = convertToArray($r3);
		//printArray($a3);
		//print "<br>";

		//print ("Count before padding:" . count($a1). " ". count($a2) . " " . count($a3) . "<br>");
		
		$count_bp = count($a1) + count ($a2) + count ($a3); 
		//print (mysql_num_rows($r3). "<br>");	
		if (count($a1) > 0 ) {
			$a1[count($a1)] = substr($n,0,$i);
		} else {
		//	echo "(zero in 1)";
示例#26
0
    $result = getResults($url);
    if (count($result) < 100) {
        for ($i = 0; $i < count($result); $i++) {
            $created = date('Y-m-d\\TH:i:s.Z\\Z', strtotime($result[$i]["created_at"]));
            if ($created > $sevendayago) {
                $sevendaycount += 1;
                if (isset($result[$i]["pull_request"])) {
                    $pullsweek += 1;
                }
            }
        }
    } else {
        $j = 1;
        while (count($result) != 0) {
            $url = "https://api.github.com/repos/" . $array[3] . "/" . $array[4] . "/issues?state=open&per_page=100&page=" . $j . "&since=" . $sevendayago;
            $result = getResults($url);
            for ($i = 0; $i < count($result); $i++) {
                $created = date('Y-m-d\\TH:i:s.Z\\Z', strtotime($result[$i]["created_at"]));
                if ($created > $sevendayago) {
                    $sevendaycount += 1;
                    if (isset($result[$i]["pull_request"])) {
                        $pullsweek += 1;
                    }
                }
            }
            $j++;
        }
    }
}
?>
示例#27
0
文件: search.php 项目: hrustz/noname
    $result[messageResult] = 'Найдено результатов: '.$n;
  } else{
    $result[messageResult] = 'Найдено результатов: '.$n;
  }
	return $result;
}

if(strlen(trim($_POST['search'])) >= 2){
  $max = 10; // максимальное количество слов во фразе
  $minLength = 2; // минимальная длина искомого слова
  $word = explode(" ", cleanPostData($_POST['search']));
  //print_r($word);
  if($word[0] == ''){
    $result[message] = 'Результаты поиска: '.$_POST['search'];
    $result[messageResult] = 'Найдено результатов: 0';
  } else{
    $words = cleanArrayToSearch($word, $max, $minLength);
    $result = getResults($words);  
  }
} else{
  $result[message] = 'Результаты поиска: '.$_POST['search'];
  $result[messageResult] = 'Найдено результатов: 0';
  $result[cont] = array();
}

if($result[message]){
  
}

$title = 'Поиск';
$content = tpl('search', $result);
示例#28
0
<?php

if (!isset($_SESSION)) {
    session_start();
}
if (isset($_SESSION['user'])) {
    $page = '1';
    $user = '******';
    $keyword = 'all';
    if (isset($_GET['page'])) {
        $page = $_GET['page'];
    }
    if (isset($_GET['user'])) {
        $user = $_GET['user'];
    }
    if (isset($_GET['keyword'])) {
        $keyword = $_GET['keyword'];
    }
    require_once $_SERVER['DOCUMENT_ROOT'] . '/libs/twitter.php';
    getResults($page, $user, $keyword);
} else {
    header('Location: ../../index.php');
}
示例#29
0
<?php

header('Content-Type: application/json');
$searchResult = 'null';
if ($_SERVER["REQUEST_METHOD"] == "GET") {
    $searchResult = $_GET["searchquery"];
    if (empty($searchResult)) {
        $searchResult = 'No search text submitted';
    } else {
        $queryResults = getResults($searchResult);
        $result = array("searchResult" => $queryResults);
        echo json_encode($result);
        //echo $queryResults;
    }
} else {
    $searchResult = 'request was not GET';
}
function getResults($userQuery)
{
    $core = 'techknowledgy_core';
    $options = array('hostname' => 'localhost', 'port' => 8983, 'timeout' => 10, 'path' => '/solr/' . $core);
    $client = new SolrClient($options);
    #if (!$client->ping()) {
    #	exit('Solr service not responding.');
    #}
    #else{
    #	print "Worked!";
    #}
    $query = new SolrQuery();
    $query->setQuery($userQuery);
    $query->setStart(0);
示例#30
-1
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);
    #echo $url . "\n\n"; echo str_replace("<a href", "\n<a href", $results) . "\n";
    #exit;
    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("//a");
    $index = 1;
    $turl = urldecode($title->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++;
    }
    #echo str_replace("<", "\n<", $doc->saveXML()); exit;
    $notfound[] = $title;
    return -1;
}