function getpagehid($cookie) { $url = 'http://172.18.0.240/selfsearch/EcardInfo/CONSUMEINFO_SEACH.ASPX '; $refeurl = 'http://172.18.0.240/selfsearch/EcardInfo/CONSUMEINFO_SEACH.ASPX '; $getda = new getdata(); $data = $getda->common($cookie, $url, $refeurl); $pattern = '/<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="(.*?)" \\/>/is'; preg_match_all($pattern, $data, $matches); $pattern1 = '/<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="(.*?)" \\/>/is'; preg_match_all($pattern1, $data, $matches1); $hidden = array("0" => $matches[1][0], "1" => $matches1[1][0]); return $hidden; }
function getlosshid($cookie) { $url = 'http://172.18.0.240/selfsearch/UserInfo/UserLoss.aspx '; $refeurl = 'http://172.18.0.240/selfsearch/Index_button.aspx'; $getda = new getdata(); $data = $getda->common($cookie, $url, $refeurl); $pattern = '/<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="(.*?)" \\/>/is'; preg_match_all($pattern, $data, $matches); $pattern1 = '/<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="(.*?)" \\/>/is'; preg_match_all($pattern1, $data, $matches1); $hidden = array("0" => $matches[1][0], "1" => $matches1[1][0]); return $hidden; }
<?php include "getting.php"; $data = new getdata(); /* $lat=41.1181; $lon=16.86953; $test=$data->get_stations($lat,$lon); echo $test; */ //$test1=$data->get_start("Prato Borgonuovo"); //echo $test1; $test2 = $data->get_connection("Parma", "Bologna Centrale", "2015-10-26");
function location_manager_inline($inline_query, $telegram, $data) { $data = new getdata(); $trovate = 0; $res = []; $id = ""; $i = 0; $idx = []; $distanza = []; $id3 = ""; $id1 = ""; $inline = ""; $id = $inline_query['id']; $lat = $inline_query["location"]['latitude']; $lon = $inline_query["location"]['longitude']; $nome = $data->get_stations($lat, $lon); $option1 = explode("\n", $nome); if ($nome == "Non ci sono stazioni") { // $content = array('chat_id' => $chat_id, 'text' => $nome,'disable_web_page_preview'=>true); $id3 = $telegram->InlineQueryResultLocation($id . "/0", $lat, $lon, "Nessuna stazione in questo luogo\nNo Rail Station around you in this place"); $res = array($id3); $content = array('inline_query_id' => $inline_query['id'], 'results' => json_encode($res)); $telegram->answerInlineQuery($content); $this->create_keyboard($telegram, $chat_id); exit; } else { // $content = array('chat_id' => 69668132,'text' => json_encode($inline_query["location"])); // $telegram->sendMessage($content); // $option = array($option1); // $optionf=array([]); for ($i = 0; $i < count($option1) - 1; $i++) { // array_push($optionf,[" ".$option1[$i]]); // $location =preg_replace('/\s+?(\S+)?$/', '', substr(trim($option1[$i]), 0, 45)); $idx[$i] = $telegram->InlineQueryResultArticle($id . "/" . $i, $option1[$i], array('message_text' => $option1[$i], 'disable_web_page_preview' => true), "http://www.piersoft.it/transportchbot/bus.png"); array_push($res, $idx[$i]); } $content = array('inline_query_id' => $inline_query['id'], 'results' => json_encode($res)); $telegram->answerInlineQuery($content); } }
<?php //file di test $lat = $_GET["lat"]; $lon = $_GET["lon"]; $r = $_GET["raggio"]; include "getting.php"; $data = new getdata(); /* print("---Previsioni---\r\n"); $test=$data->get_forecast("Lecce"); print($test); $json_string = file_get_contents("http://api.wunderground.com/api/b3f95b06a21229ff/forecast/lang:IT/q/pws:IPUGLIAL7.json"); $parsed_json = json_decode($json_string); //var_dump($parsed_json->forecast->txt_forecast->forecastday[0]->title); $temp_c = $parsed_json->{'forecast'}->{'txt_forecast'}->{'forecastday'}[0]->{'title'}; $temp_c1 =", "; $temp_c2 =$parsed_json->{'forecast'}->{'txt_forecast'}->{'forecastday'}[0]->{'fcttext_metric'}; echo $temp_c.$temp_c1.$temp_c2; echo "<br>"; print("\n---Allerta meteo---\r\n"); $html = file_get_contents('http://ppc-lecce.3plab.it'); $html = iconv('ASCII', 'UTF-8//IGNORE', $html); $html = sprintf('<html><head><title></title></head><body>%s</body></html>', $html); $html = sprintf('<html><head><title></title></head><body>%s</body></html>', $html); $html = sprintf('<html><head><title></title></head><body>%s</body></html>', $html); $html =str_replace("Consulta il","<!--",$html);