本文整理匯總了PHP中Twitter::searchResultsLatLong方法的典型用法代碼示例。如果您正苦於以下問題:PHP Twitter::searchResultsLatLong方法的具體用法?PHP Twitter::searchResultsLatLong怎麽用?PHP Twitter::searchResultsLatLong使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Twitter
的用法示例。
在下文中一共展示了Twitter::searchResultsLatLong方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: LoadIntoData
<?php
require_once "twitter.class.php";
require_once "loadIntoData.php";
$Loader = new LoadIntoData();
$Twitter = new Twitter();
$con = mysql_connect(localhost, "slidat_carlos", "cortes299940");
mysql_select_db("slidat_cps630") or die("Unable to select database");
$query = "SELECT Location, Latitude, Longitude FROM Locations ORDER BY Date ASC LIMIT 0,5";
$resource = mysql_query($query);
while ($row = mysql_fetch_array($resource, MYSQL_ASSOC)) {
$location = $row["Location"];
$lat = $row["Latitude"];
$long = $row["Longitude"];
$myDate = date('y-m-d H:i:s');
$results = $Twitter->searchResultsLatLong($lat, $long);
$Loader->loadIntoData($results, $location, $lat, $long);
mysql_query("UPDATE Locations SET Date = '{$myDate}' WHERE Location = '{$location}'");
}
mysql_close();
示例2: main
public function main($Location, $unitNum, $timeUnit, $numResults, $session)
{
$Loader = new LoadIntoData();
$Geocoder = new Geocoder();
$Twitter = new Twitter();
$Output = new CreateOutput();
//$Location = 'Toronto';
$con = mysql_connect(localhost, "slidat_carlos", "cortes299940");
mysql_select_db("slidat_cps630") or die("Unable to select database");
$Long_Lat = $Geocoder->geoCoding($Location);
$latitude = $Long_Lat["Lat"];
$longitude = $Long_Lat["Long"];
//echo "main:".$longitude;
$Loc = $Geocoder->geoCodingReverse($latitude, $longitude);
$new_location = $Loc["location"];
$radius = 10;
$qry = "SELECT Location, Latitude, Longitude FROM Locations";
//$qry = "SELECT * from Locations";
$resource = mysql_query($qry);
$location_table_size = 0;
if (mysql_num_rows($resource) > 0) {
$location_table_size = 1;
}
while ($row = mysql_fetch_array($resource, MYSQL_ASSOC)) {
$row_location = $row["Location"];
$row_lat = $row["Latitude"];
$row_long = $row["Longitude"];
$distance = $Geocoder->getDistanceBetweenPointsNew($latitude, $longitude, $row_lat, $row_long);
//echo "distance= ". $distance ." ";
if ($distance < $radius) {
$matched = 1;
break;
} elseif ($distance >= $radius) {
$matched = 0;
}
}
if ($matched == 1 && $latitude != '' && $longitude != '') {
$results = $Twitter->searchResultsLatLong($latitude, $longitude);
$Loader->loadIntoData($results, $new_location, $latitude, $longitude);
$querys2 = "SELECT Text FROM data WHERE Location = '{$new_location}'";
$response2 = mysql_query($querys2);
$myDate = date('y-m-d H:i:s');
mysql_query("UPDATE Locations SET Date = '{$myDate}' WHERE Location = '{$new_location}'");
/*
echo "<h3><u>DATA</u></h3>";
$counter = 1;
while (($row2 = mysql_fetch_array($response2, MYSQL_ASSOC)))
{
if($counter > 20)
{
break;
}
echo"<h3>Text-hashtag: ". $row2["Text"] ."</h3>";
$counter = $counter + 1;
}
*/
} elseif (($matched == 0 || $location_table_size == 0) && $latitude != '' && $longitude != '') {
//new location
$myDate = date('y-m-d H:i:s');
$query = "INSERT INTO Locations Values ('{$new_location}', '{$latitude}', '{$longitude}','{$myDate}')";
$response = mysql_query($query);
//echo "balls";
$results = $Twitter->searchResultsLatLong($latitude, $longitude);
//$command = "/usr/local/bin/php -f /home/slidat/public_html/cgi-bin/loadIntoDataCL.php -a $results -b $new_location -c $latitude -d $longitude";
// exec( "$command > /dev/null &");
$Loader->loadIntoData($results, $new_location, $latitude, $longitude);
}
mysql_close();
//echo "Create output";
//Create output table for client. Based on client fiends
return $Output->createOutput($new_location, $unitNum, $timeUnit, $numResults, $session);
}
示例3: while
while ($row = mysql_fetch_array($R, MYSQL_ASSOC)) {
$array = explode(' ', $row["Username"]);
//$TweetsWithHashtag = $TweetsWithHashtag.$row["Text"]."<br/><br/>";
$TweetsWithHashtag = $TweetsWithHashtag . "<div id=\"atweet\"><div id=\"tweettext\">" . $row["Text"] . "</div><div id=\"usertweet\"><span id=\"by\">By: </span>" . $array[0] . "</div></div>";
}
} else {
if ($_GET["RadTweet"] == "getTrends") {
$BeginTime = $_GET["BeginTime"];
$Tweet = $_GET["Tweet"];
$Location = $_GET["Location"];
$Long_Lat = $Geocoder->geoCoding($Location);
$latitude = $Long_Lat["Lat"];
$longitude = $Long_Lat["Long"];
//echo "main:".$longitude;
$Loc = $Geocoder->geoCodingReverse($latitude, $longitude);
$new_location = $Loc["location"];
$results = $Twitter->searchResultsLatLong($latitude, $longitude);
$Loader->loadIntoData($results, $new_location, $latitude, $longitude);
$Loader->loadIntoData($results, $new_location, $latitude, $longitude);
$sqlQuery2 = "SELECT Text, Username FROM data WHERE Text LIKE '%{$Tweet}%' AND Location = '{$new_location}' AND DATE > DATE_SUB( NOW() , INTERVAL 4 HOUR)";
$R = mysql_query($sqlQuery2) or die(" " . mysql_error());
$TweetsWithHashtag = "";
while ($row = mysql_fetch_array($R, MYSQL_ASSOC)) {
$array = explode(' ', $row["Username"]);
//$TweetsWithHashtag = $TweetsWithHashtag.$row["Text"]."<br/><br/>";
$TweetsWithHashtag = $TweetsWithHashtag . "<div id=\"atweet\"><div id=\"tweettext\">" . $row["Text"] . "</div><div id=\"usertweet\"><span id=\"by\">By: </span>" . $array[0] . "</div></div>";
}
}
}
echo $TweetsWithHashtag;
mysql_close();