2012-04-30 23 views
0

私は自分のページをコーディングする方法を見つけ出そうとしています。私のフォームに回答が入力されると、GoogleマップAPIを通してその答えを検索します。私はコーディング権を得ることができない、どのような助けが私の目標を達成する方法で大きく評価されるだろう!ありがとう。GoogleマップAPIを使用すると助けが必要です

<head> 
     <!-- This is my first trashy online quiz! --> 
      <title>Extra Quiz Information</title> 
</head> 
<body> 
    <h1> More about your quiz results!</h1> 
    <?php 
     if (isset($_COOKIE['visit_id'])){ 
      $visit_id = $_COOKIE['visit_id']; 
      $all_variables = json_decode(file_get_contents("/var/www/html/data/$visit_id.json"), TRUE); 
      //var_dump ($all_variables); 
      echo "<p>"; 
       echo "Our results show that when you took the quiz: What Environment Suits You? on "; echo $all_variables['timestamp']; 
       echo ", <br>you expressed that your favorite place to be in the whole world was: "; echo $all_variables['answer1']; 
      echo "</p>"; 

      $google_map_stuff = json_decode(file_get_contents echo <a href="http://maps.googleapis.com/maps/api/geocode/json?address=', urlencode($all_variables['answer1'])">, TRUE); 
      echo $google_map_stuff["results"][0]["types"][0]; 
      //var_dump($google_map_stuff); 
     } else { 
      echo "You have not yet taken the quiz titled: What Environment Suits You?<br> 
      Please "; echo '<a href="roate1-form.html">take it now</a>'; echo " and then return to this page after you have finished."; 
     } 

       ?> 

</body> 

答えて

0

エラーメッセージを持っていますか?あなたは本当にあなたのようにAPIを呼び出すべきではありません。 WebサービスAPIを使用する場合は、サーバーから行う必要があります。それ以外の場合は、JavaScriptを使用する場合はGoogle Maps Javascript API reference (I linked you straight to the geocoder referenceをご覧ください。

私は自分のコードであなたを退屈させず、代わりにGoogle code samples page.

への直接リンクを提供します。
関連する問題