Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

     Define_Com Class(#XPRIM_HttpRequest) Name(#Req)
Define_Com Class(#XPRIM_RandomAccessJsonReader) Name(#Reader)
...
#Req.DoGet Url('https://maps.googleapis.com/maps/api/geocode/json?...')

* 要求が正しく実行されたか確認

     If (#Req.Response.IsSuccessHttpStatusCode)

    * 応答のJSON リーダー・ソースを HTTP 要求から設定

       #Reader.SetSourceHttpResponse HttpResponse(#Req.Response)

    *  ('lat' と 'lng' 値が含まれている) 'location' オブジェクトにナビゲート

    * ナビゲーション・パスを指定して、'location' エレメントへナビゲート

    * パスの名前とインデックスはスラッシュで区切る

       #Reader.BeginObjectWithPath Path('results/1/geometry/location')

    * 緯度と経度の値を取得

       #Latitude := #Reader.ReadNumberWithName('lat')
  #Longitude := #Reader.ReadNumberWithName('lng')

    *  "BeginObject" を "EndObject" で終了

       #Reader.EndObject
Endif


次は: 次は:無効な応答を確認