FINAL PROJECT CODE - aditisoni/Txt-Web-app GitHub Wiki

FINAL PROJECT CODE

We have used softwares like Eclipse,Apache,Ubuntu to make this project.We also have used Google maps to find out the distances between the two places which user gives,through coordinate system.

Here is the final code:

`<?php echo "



";
$message = "$place1,$place2"; //getting data from the user,will be saved in the two variables along with comma.
if(isset($_GET['txtweb-message']))
$message = $_GET['txtweb-message']; $arr = explode(",", $message); //explode function will find comma and will seperatly save the places. $place1=$arr[0]; $place2=$arr[1]; function file_get_contents_curl($url) { $ch = curl_init();

curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser. curl_setopt($ch, CURLOPT_URL, $url);

$data = curl_exec($ch); curl_close($ch);

return $data; }

function distance($place1,$place2){ //getting distance between the two places through google maps(coordinate system) $url='http://maps.google.com/maps/nav?q=from:'.$place1.'%20to:'.$place2; $data = file_get_contents_curl($url); $result = explode("meters", $data); $meter=""; $j=0; $flag=0; if($result[1]){ while($result[1][$j]!=','){ if($flag==1) $meter.=$result[1][$j]; if($result[1][$j]==':') $flag=1; $j++;

	}

} return $meter; }

$a= distance($place1,$place2)/1000; //changing meters to kilometers

if($a<=1.6){ //autofare calculator as per the newly applied rates by the government of Maharashtra in Bombay city. echo "the fare is Rs.12"; } else{ $b=12+$a7-1.67; echo "the fare is "; echo $b; } echo "

"; ?> `
⚠️ **GitHub.com Fallback** ⚠️