document.write("<div class=\"pastie\">\n");
document.write("  <link href=\"http://pastie.org/stylesheets/embed.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n");
document.write("  <link href=\"http://pastie.org/stylesheets/clean.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n");
document.write("  \n");
document.write("\n");
document.write("  \n");
document.write("  \n");
document.write("\n");
document.write("\n");
document.write("\n");
document.write("\n");
document.write("\n");
document.write("\n");
document.write("\n");
document.write("	\n");
document.write("	<div class=\"allcode\">\n");
document.write("		<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n");
document.write("		<tr>\n");
document.write("			<td>\n");
document.write("				\n");
document.write("				<pre class=\"textmate-source-numbers\">1\n");
document.write("2\n");
document.write("3\n");
document.write("4\n");
document.write("5\n");
document.write("6\n");
document.write("7\n");
document.write("8\n");
document.write("9\n");
document.write("10\n");
document.write("11\n");
document.write("12\n");
document.write("13\n");
document.write("14\n");
document.write("15\n");
document.write("16\n");
document.write("17\n");
document.write("18\n");
document.write("19\n");
document.write("20\n");
document.write("21\n");
document.write("22\n");
document.write("23\n");
document.write("24\n");
document.write("25\n");
document.write("26\n");
document.write("27\n");
document.write("28\n");
document.write("29\n");
document.write("<\/pre>\n");
document.write("			<\/td>\n");
document.write("		<td>\n");
document.write("		<pre class=\"textmate-source\"><pre class=\"sunburst\"><span class=\'source source_php source_php_embedded source_php_embedded_block source_php_embedded_block_html\'>&lt;?\n");
document.write("<span class=\'meta meta_function meta_function_php\'><span class=\'storage storage_type storage_type_function storage_type_function_php\'>function<\/span> <span class=\'entity entity_name entity_name_function entity_name_function_php\'>gmap_calc_address<\/span>(<span class=\'meta meta_function meta_function_arguments meta_function_arguments_php\'><span class=\'meta meta_function meta_function_argument meta_function_argument_default meta_function_argument_default_php\'><span class=\'variable variable_other variable_other_php\'>$measure<\/span><span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span><span class=\'constant constant_numeric constant_numeric_php\'>1<\/span><\/span>,<span class=\'meta meta_function meta_function_argument meta_function_argument_no-default meta_function_argument_no-default_php\'><span class=\'variable variable_other variable_other_php\'>$start<\/span><\/span>,<span class=\'meta meta_function meta_function_argument meta_function_argument_no-default meta_function_argument_no-default_php\'><span class=\'variable variable_other variable_other_php\'>$end<\/span><\/span><\/span>)<\/span> {\n");
document.write("\n");
document.write("  <span class=\'comment comment_line comment_line_double-slash comment_line_double-slash_php\'>// make the curl request<\/span>\n");
document.write("  <span class=\'variable variable_other variable_other_php\'>$url<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'support support_function support_function_string support_function_string_php\'>str_replace<\/span>(<span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'> <\/span>&quot;<\/span>, <span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'>+<\/span>&quot;<\/span>, <span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'>http://maps.google.com/maps?q=from+<span class=\'variable variable_other variable_other_php\'>$start<\/span><\/span><\/span>\n");
document.write("<span class=\"String\"><span class=\"String\">    +to+<span class=\'variable variable_other variable_other_php\'>$end<\/span>&amp;output=kml<\/span>&quot;<\/span>);\n");
document.write("  <span class=\'variable variable_other variable_other_php\'>$ch<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'support support_function support_function_interface support_function_interface_php\'>curl_init<\/span>();\n");
document.write("  <span class=\'support support_function support_function_interface support_function_interface_php\'>curl_setopt<\/span>(<span class=\'variable variable_other variable_other_php\'>$ch<\/span>, <span class=\'constant constant_other constant_other_php\'>CURLOPT_URL<\/span>, <span class=\'variable variable_other variable_other_php\'>$url<\/span>);\n");
document.write("  <span class=\'support support_function support_function_interface support_function_interface_php\'>curl_setopt<\/span>(<span class=\'variable variable_other variable_other_php\'>$ch<\/span>, <span class=\'constant constant_other constant_other_php\'>CURLOPT_HEADER<\/span>, <span class=\'constant constant_numeric constant_numeric_php\'>0<\/span>);\n");
document.write("  <span class=\'support support_function support_function_interface support_function_interface_php\'>curl_setopt<\/span>(<span class=\'variable variable_other variable_other_php\'>$ch<\/span>, <span class=\'constant constant_other constant_other_php\'>CURLOPT_RETURNTRANSFER<\/span>, <span class=\'constant constant_numeric constant_numeric_php\'>1<\/span>);\n");
document.write("  <span class=\'variable variable_other variable_other_php\'>$data<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'support support_function support_function_interface support_function_interface_php\'>curl_exec<\/span>(<span class=\'variable variable_other variable_other_php\'>$ch<\/span>);  \n");
document.write("  <span class=\'support support_function support_function_interface support_function_interface_php\'>curl_close<\/span> (<span class=\'variable variable_other variable_other_php\'>$ch<\/span>);\n");
document.write("\n");
document.write("  <span class=\'comment comment_line comment_line_double-slash comment_line_double-slash_php\'>// ugly substringing to get time<\/span>\n");
document.write("  <span class=\'keyword keyword_control keyword_control_php\'>if<\/span>(<span class=\'variable variable_other variable_other_php\'>$measure<\/span><span class=\'keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_php\'>==<\/span><span class=\'constant constant_numeric constant_numeric_php\'>2<\/span>) {\n");
document.write("    <span class=\'variable variable_other variable_other_php\'>$result<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'support support_function support_function_string support_function_string_php\'>substr<\/span>(<span class=\'variable variable_other variable_other_php\'>$data<\/span>, <span class=\'support support_function support_function_string support_function_string_php\'>strpos<\/span>(<span class=\'variable variable_other variable_other_php\'>$data<\/span>, <span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'>(about<\/span>&quot;<\/span>)<span class=\'keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_php\'>+<\/span><span class=\'constant constant_numeric constant_numeric_php\'>7<\/span>, <span class=\'constant constant_numeric constant_numeric_php\'>50<\/span>);\n");
document.write("    <span class=\'variable variable_other variable_other_php\'>$result<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'support support_function support_function_string support_function_string_php\'>substr<\/span>(<span class=\'variable variable_other variable_other_php\'>$result<\/span>, <span class=\'constant constant_numeric constant_numeric_php\'>0<\/span>, <span class=\'support support_function support_function_string support_function_string_php\'>strpos<\/span>(<span class=\'variable variable_other variable_other_php\'>$result<\/span>, <span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'>mins)<\/span>&quot;<\/span>));         \n");
document.write("  }\n");
document.write("  <span class=\'comment comment_line comment_line_double-slash comment_line_double-slash_php\'>// ugly substringing to get distance  <\/span>\n");
document.write("  <span class=\'keyword keyword_control keyword_control_php\'>else<\/span> {\n");
document.write("    <span class=\'variable variable_other variable_other_php\'>$result<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'support support_function support_function_string support_function_string_php\'>substr<\/span>(<span class=\'variable variable_other variable_other_php\'>$data<\/span>, <span class=\'support support_function support_function_string support_function_string_php\'>strpos<\/span>(<span class=\'variable variable_other variable_other_php\'>$data<\/span>, <span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'>Distance:<\/span>&quot;<\/span>)<span class=\'keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_php\'>+<\/span><span class=\'constant constant_numeric constant_numeric_php\'>9<\/span>, <span class=\'constant constant_numeric constant_numeric_php\'>50<\/span>);\n");
document.write("    <span class=\'variable variable_other variable_other_php\'>$result<\/span> <span class=\'keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php\'>=<\/span> <span class=\'support support_function support_function_string support_function_string_php\'>substr<\/span>(<span class=\'variable variable_other variable_other_php\'>$result<\/span>, <span class=\'constant constant_numeric constant_numeric_php\'>0<\/span>, <span class=\'support support_function support_function_string support_function_string_php\'>strpos<\/span>(<span class=\'variable variable_other variable_other_php\'>$result<\/span>, <span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'>mi<\/span>&quot;<\/span>)<span class=\'keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_php\'>-<\/span><span class=\'constant constant_numeric constant_numeric_php\'>6<\/span>); \n");
document.write("  }\n");
document.write("  <span class=\'keyword keyword_control keyword_control_php\'>return<\/span> <span class=\'variable variable_other variable_other_php\'>$result<\/span>;\n");
document.write("}\n");
document.write("\n");
document.write("<span class=\'support support_function support_function_construct support_function_construct_php\'>echo<\/span> <span class=\'meta meta_function-call meta_function-call_php\'>gmap_calc_address<\/span>(<span class=\'constant constant_numeric constant_numeric_php\'>1<\/span>, <span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'>4150 Regents Park Row, La Jolla, CA<\/span>&quot;<\/span>, \n");
document.write("  <span class=\'string string_quoted string_quoted_double string_quoted_double_php\'>&quot;<span class=\'meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php\'>4485 La Jolla Village Dr, San Diego, CA<\/span>&quot;<\/span>);\n");
document.write("<span class=\'source source_php\'>?<\/span>&gt;<\/span>\n");
document.write("<\/pre><\/pre>\n");
document.write("		<\/td>\n");
document.write("		<\/tr>\n");
document.write("		<\/table>\n");
document.write("	\n");
document.write("	<\/div>\n");
document.write("\n");
document.write("\n");
document.write("  \n");
document.write("  \n");
document.write("  <div class=\"credit\">\n");
document.write("    <div class=\"buttons\">\n");
document.write("      <a href=\"http://pastie.org/pastes/319378.txt\">\n");
document.write("      <img src=\"http://pastie.org/images/view.png\" height=\"20\" width=\"67\" /><\/a>\n");
document.write("    <\/div>\n");
document.write("  \n");
document.write("    <a href=\"http://pastie.org/319378\">Pastie #319378<\/a> linked directly from <a href=\"http://pastie.org/\">Pastie<\/a>.\n");
document.write("  <\/div><\/div>");

