How do you use the Tide feature properly?

  • 1
  • Question
  • Updated 8 years ago
Could someone help with the Tide feature using PHP I have described below? I can print the complete object structure with print_r, but don't understand the structure well enough to return individual values, in this case, $tide. I can print the geolookup code example with no problem, which is straight from the documentation. Any help will be much appreciated as I have spent hours trying to figure this out and I am just done banging my head against the wall. Thanks in advance.

$json_string = file_get_contents("[ID]/tide/q/CA/San_Francisco.json");
$parsed_json = json_decode($json_string);
$tide = $parsed_json->{'tideInfo'}->{'tideSite'};
echo "Current tide in: ${tide}\n";
Photo of jhwdca


  • 1 Post
  • 0 Reply Likes

Posted 8 years ago

  • 1
Photo of Naescent


  • 2 Posts
  • 0 Reply Likes
I have exactly the same problem. I posted a question the other day but no response. Not a very active board.

Did you ever get it solved?

Photo of afelicioni


  • 227 Posts
  • 43 Reply Likes
As an hint for both questions, be warned that tideInfo and tideSummaryStats are returning data structure wrapped in a one element array (this is not explained in docs, you have to see it by yourselves in json raw response).