Commit 5d092fbacce4fb6da77dbd2889ca3f5ca71008d4
1 parent
0625955c
Exists in
master
and in
7 other branches
Inclusão da busca por coordenadas no Twitter
Showing
4 changed files
with
123 additions
and
0 deletions
Show diff stats
admin/admin.db
No preview for this file type
ferramentas/identifica/index.js.php
@@ -361,6 +361,8 @@ i3GEOF.identifica = { | @@ -361,6 +361,8 @@ i3GEOF.identifica = { | ||
361 | param = y[0]+"_"+y[1]+"_"+y[2]+"_"+s+"_"+x[0]+"_"+x[1]+"_"+x[2]+"_"+w; | 361 | param = y[0]+"_"+y[1]+"_"+y[2]+"_"+s+"_"+x[0]+"_"+x[1]+"_"+x[2]+"_"+w; |
362 | url = "http://tools.wikimedia.de/~magnus/geo/geohack.php?params="+param; | 362 | url = "http://tools.wikimedia.de/~magnus/geo/geohack.php?params="+param; |
363 | linhas = "<a href='"+url+"' target=blank >Buscadores web</a><br>"; | 363 | linhas = "<a href='"+url+"' target=blank >Buscadores web</a><br>"; |
364 | + //url = i3GEO.configura.locaplic+"/ferramentas/identifica/twitter.php?geocode="+i3GEOF.identifica.x+","+i3GEOF.identifica.y+",5km"; | ||
365 | + //linhas = "<a href='"+url+"' target=blank >Twitter</a><br>"; | ||
364 | return linhas; | 366 | return linhas; |
365 | }, | 367 | }, |
366 | /* | 368 | /* |
@@ -0,0 +1,67 @@ | @@ -0,0 +1,67 @@ | ||
1 | +<html> | ||
2 | +<head> | ||
3 | +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> | ||
4 | +<link rel="stylesheet" type="text/css" href="../../css/i3geo.css.php"> | ||
5 | +</head> | ||
6 | +<body style="background-color:white;margin:10px"> | ||
7 | +<?php | ||
8 | +if(empty($_GET["km"])) | ||
9 | +{$km = 5;} | ||
10 | +else | ||
11 | +{$km = $_GET["km"];} | ||
12 | +$par = $_GET["x"].",".$_GET["y"]; | ||
13 | +echo "<p class=paragrafo >Raio de <input type=text size=4 value='$km' id=km onchange='recarrega($par,this.value)'> km</p>"; | ||
14 | +include("../../classesphp/carrega_ext.php"); | ||
15 | +$s = PHP_SHLIB_SUFFIX; | ||
16 | +if(!function_exists('curl_init')) | ||
17 | +{@dl( 'php_curl'.'.'.$s );} | ||
18 | +if(!function_exists('curl_init')) | ||
19 | +{echo "curl não instalado";} | ||
20 | +$curl = curl_init(); | ||
21 | +curl_setopt ($curl, CURLOPT_URL, "http://search.twitter.com/search.json?geocode=".$_GET["y"].",".$_GET["x"].",".$km."km"); | ||
22 | +//teste | ||
23 | +//curl_setopt ($curl, CURLOPT_URL, "http://search.twitter.com/search.json?geocode=37.781157,-122.398720,2km"); | ||
24 | +curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); | ||
25 | +$result = curl_exec($curl); | ||
26 | +curl_close ($curl); | ||
27 | +$result = fixEncoding($result); | ||
28 | +$result = json_decode( $result, true ); | ||
29 | + | ||
30 | +//echo "<pre>"; | ||
31 | +//var_dump($result); | ||
32 | + | ||
33 | +if(isset($result["error"]) || count($result["results"]) == 0) | ||
34 | +{ | ||
35 | + echo "Nada encontrado"; | ||
36 | +} | ||
37 | +else | ||
38 | +{ | ||
39 | + $html = "<table class='lista4'>"; | ||
40 | + foreach($result["results"] as $r) | ||
41 | + { | ||
42 | + | ||
43 | + $html .= "<tr><td><img src='".$r["profile_image_url"]."' /></td>"; | ||
44 | + $html .= "<td><a href='http://twitter.com/".$r["from_user"]."' target=_blank '>".$r["from_user"]."</a><br>"; | ||
45 | + $html .= "<span style=color:gray >".$r["created_at"]."</span><br>"; | ||
46 | + $html .= $r["text"]."<br></td></tr>"; | ||
47 | + } | ||
48 | + echo $html."</table>"; | ||
49 | +} | ||
50 | +function fixEncoding($in_str) | ||
51 | +{ | ||
52 | + $cur_encoding = mb_detect_encoding($in_str) ; | ||
53 | + if($cur_encoding == "UTF-8" && mb_check_encoding($in_str,"UTF-8")) | ||
54 | + {return $in_str;} | ||
55 | + else | ||
56 | + {return utf8_encode($in_str);} | ||
57 | +} | ||
58 | +?> | ||
59 | +</body> | ||
60 | +<script> | ||
61 | +function recarrega(x,y,km){ | ||
62 | + var url = window.location.href.split("?"); | ||
63 | + var url = url[0]+"?x="+x+"&y="+y+"&km="+km; | ||
64 | + window.location.href = url; | ||
65 | +} | ||
66 | + | ||
67 | +</script> | ||
0 | \ No newline at end of file | 68 | \ No newline at end of file |
@@ -0,0 +1,54 @@ | @@ -0,0 +1,54 @@ | ||
1 | +<html> | ||
2 | +<head> | ||
3 | +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> | ||
4 | +<link rel="stylesheet" type="text/css" href="../../css/i3geo.css.php"> | ||
5 | +</head> | ||
6 | +<body style="background-color:white;margin:10px"> | ||
7 | +<?php | ||
8 | +include("../../classesphp/carrega_ext.php"); | ||
9 | +$s = PHP_SHLIB_SUFFIX; | ||
10 | +if(!function_exists('curl_init')) | ||
11 | +{@dl( 'php_curl'.'.'.$s );} | ||
12 | +if(!function_exists('curl_init')) | ||
13 | +{echo "curl não instalado";} | ||
14 | +$curl = curl_init(); | ||
15 | +//lista de places | ||
16 | +curl_setopt ($curl, CURLOPT_URL, "http://api.twitter.com/1/geo/nearby_places.json?lat=".$_GET["y"]."&long=".$_GET["x"]."&accuracy=0&granularity=neighborhood"); | ||
17 | +curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); | ||
18 | +$result = curl_exec($curl); | ||
19 | +curl_close ($curl); | ||
20 | +$result = fixEncoding($result); | ||
21 | +$result = json_decode( $result, true ); | ||
22 | +/* | ||
23 | +echo "<pre>"; | ||
24 | +var_dump($result); | ||
25 | +exit; | ||
26 | +*/ | ||
27 | +if(isset($result["error"]) || count($result["result"]["places"]) == 0) | ||
28 | +{ | ||
29 | + echo "Nada encontrado"; | ||
30 | +} | ||
31 | +else | ||
32 | +{ | ||
33 | + $html = "<table class='lista4'>"; | ||
34 | + $places = $result["result"]["places"]; | ||
35 | + foreach($places as $p) | ||
36 | + { | ||
37 | + | ||
38 | + $html .= "<tr>"; | ||
39 | + $html .= "<td><a href='http://search.twitter.com/search?q=place:".$p["id"]."' target=_self '>".$p["full_name"]."</a><br>"; | ||
40 | + $html .= "<span style=color:gray >".$p["place_type"]."</span>"; | ||
41 | + $html .= "</td></tr>"; | ||
42 | + } | ||
43 | + echo $html."</table>"; | ||
44 | +} | ||
45 | +function fixEncoding($in_str) | ||
46 | +{ | ||
47 | + $cur_encoding = mb_detect_encoding($in_str) ; | ||
48 | + if($cur_encoding == "UTF-8" && mb_check_encoding($in_str,"UTF-8")) | ||
49 | + {return $in_str;} | ||
50 | + else | ||
51 | + {return utf8_encode($in_str);} | ||
52 | +} | ||
53 | +?> | ||
54 | +</body> | ||
0 | \ No newline at end of file | 55 | \ No newline at end of file |