From 5d092fbacce4fb6da77dbd2889ca3f5ca71008d4 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Thu, 9 Dec 2010 23:56:26 +0000 Subject: [PATCH] Inclusão da busca por coordenadas no Twitter --- admin/admin.db | Bin 70656 -> 0 bytes ferramentas/identifica/index.js.php | 2 ++ ferramentas/identifica/twitter.php | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ferramentas/identifica/twitterplaces.php | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 123 insertions(+), 0 deletions(-) create mode 100644 ferramentas/identifica/twitter.php create mode 100644 ferramentas/identifica/twitterplaces.php diff --git a/admin/admin.db b/admin/admin.db index 1d8f8d3..40c41a8 100644 Binary files a/admin/admin.db and b/admin/admin.db differ diff --git a/ferramentas/identifica/index.js.php b/ferramentas/identifica/index.js.php index e3b119f..8204ebe 100644 --- a/ferramentas/identifica/index.js.php +++ b/ferramentas/identifica/index.js.php @@ -361,6 +361,8 @@ i3GEOF.identifica = { param = y[0]+"_"+y[1]+"_"+y[2]+"_"+s+"_"+x[0]+"_"+x[1]+"_"+x[2]+"_"+w; url = "http://tools.wikimedia.de/~magnus/geo/geohack.php?params="+param; linhas = "Buscadores web
"; + //url = i3GEO.configura.locaplic+"/ferramentas/identifica/twitter.php?geocode="+i3GEOF.identifica.x+","+i3GEOF.identifica.y+",5km"; + //linhas = "Twitter
"; return linhas; }, /* diff --git a/ferramentas/identifica/twitter.php b/ferramentas/identifica/twitter.php new file mode 100644 index 0000000..e0d542d --- /dev/null +++ b/ferramentas/identifica/twitter.php @@ -0,0 +1,67 @@ + + + + + + +Raio de km

"; +include("../../classesphp/carrega_ext.php"); +$s = PHP_SHLIB_SUFFIX; +if(!function_exists('curl_init')) +{@dl( 'php_curl'.'.'.$s );} +if(!function_exists('curl_init')) +{echo "curl não instalado";} +$curl = curl_init(); +curl_setopt ($curl, CURLOPT_URL, "http://search.twitter.com/search.json?geocode=".$_GET["y"].",".$_GET["x"].",".$km."km"); +//teste +//curl_setopt ($curl, CURLOPT_URL, "http://search.twitter.com/search.json?geocode=37.781157,-122.398720,2km"); +curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); +$result = curl_exec($curl); +curl_close ($curl); +$result = fixEncoding($result); +$result = json_decode( $result, true ); + +//echo "
";
+//var_dump($result);
+
+if(isset($result["error"]) || count($result["results"]) == 0)
+{
+	echo "Nada encontrado";
+}
+else
+{
+	$html = "";
+	foreach($result["results"] as $r)
+	{ 
+		
+		$html .= "";
+		$html .= "";
+	}
+	echo $html."
".$r["from_user"]."
"; + $html .= "".$r["created_at"]."
"; + $html .= $r["text"]."
"; +} +function fixEncoding($in_str) +{ + $cur_encoding = mb_detect_encoding($in_str) ; + if($cur_encoding == "UTF-8" && mb_check_encoding($in_str,"UTF-8")) + {return $in_str;} + else + {return utf8_encode($in_str);} +} +?> + + \ No newline at end of file diff --git a/ferramentas/identifica/twitterplaces.php b/ferramentas/identifica/twitterplaces.php new file mode 100644 index 0000000..6ffc40a --- /dev/null +++ b/ferramentas/identifica/twitterplaces.php @@ -0,0 +1,54 @@ + + + + + + +"; +var_dump($result); +exit; +*/ +if(isset($result["error"]) || count($result["result"]["places"]) == 0) +{ + echo "Nada encontrado"; +} +else +{ + $html = ""; + $places = $result["result"]["places"]; + foreach($places as $p) + { + + $html .= ""; + $html .= ""; + } + echo $html."
".$p["full_name"]."
"; + $html .= "".$p["place_type"].""; + $html .= "
"; +} +function fixEncoding($in_str) +{ + $cur_encoding = mb_detect_encoding($in_str) ; + if($cur_encoding == "UTF-8" && mb_check_encoding($in_str,"UTF-8")) + {return $in_str;} + else + {return utf8_encode($in_str);} +} +?> + \ No newline at end of file -- libgit2 0.21.2