41 lines
1.3 KiB
PHP
41 lines
1.3 KiB
PHP
<?php
|
|
|
|
$lat=-0.11307855346801365;
|
|
$lon=-78.82107184970664;
|
|
|
|
require_once('/var/www/earthquakenetwork.it/mysql/codebird.php');
|
|
|
|
|
|
\Codebird\Codebird::setConsumerKey("ohMqhP9qQKMXSyNhdGltmnvgA", "ljMnxTuEIKDINSedkusbgRj6lIruB8Oi5EP6WOaZ6uW9DJg3gu");
|
|
$cb = \Codebird\Codebird::getInstance();
|
|
$cb->setToken("1707171247-n3v2z1JNPhJdkSJY2ES9PVFKWav9TgUPBPS22hI", "rgTMihngYdqHc69eFYjloZoSnzTOficDyG5FTm1zNqGmq");
|
|
|
|
$url = "http://maps.googleapis.com/maps/api/geocode/json?latlng=".$lat.",".$lon."&sensor=true&language=es";
|
|
$data = @file_get_contents($url);
|
|
$jsondata = json_decode($data,true);
|
|
var_dump($jsondata);
|
|
|
|
$c=count($jsondata['results']['0']['address_components']);
|
|
|
|
$region="";
|
|
$country="";
|
|
for ($i=0;$i<$c;$i++){
|
|
if (strcmp($jsondata['results']['0']['address_components'][$i]['types'][0],"country")==0){
|
|
$country=$jsondata['results']['0']['address_components'][$i]['long_name'];
|
|
}
|
|
if (strcmp($jsondata['results']['0']['address_components'][$i]['types'][0],"administrative_area_level_2")==0){
|
|
$region=$jsondata['results']['0']['address_components'][$i]['long_name'];
|
|
}
|
|
}
|
|
|
|
$text="Sismo detectado en tiempo real en ".$region." #".$country." por @SismoDetector. Descarga la app https://goo.gl/5Gz5PY";
|
|
|
|
$params = array(
|
|
'status' => $text
|
|
);
|
|
|
|
//$reply = $cb->statuses_update($params);
|
|
|
|
|
|
?>
|