Skip to content

Instantly share code, notes, and snippets.

@sumardi
Last active April 21, 2017 09:11
Show Gist options
  • Save sumardi/bfdff68c5c4c3c49a8f8645808c80516 to your computer and use it in GitHub Desktop.
Save sumardi/bfdff68c5c4c3c49a8f8645808c80516 to your computer and use it in GitHub Desktop.

Revisions

  1. sumardi revised this gist Apr 21, 2017. 1 changed file with 14 additions and 2 deletions.
    16 changes: 14 additions & 2 deletions fetch_json_api.php
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,17 @@
    $url = urlencode ("http://domain/path/to/json");
    // $url = urlencode ("http://domain/path/to/json");

    $json = json_decode(file_get_contents($url), true);
    // $json = json_decode(file_get_contents($url), true);

    // dd($json);

    $url = "https://atsbopis.asuscomm.com:8446/html/stats/rest/index.php?entity=realtime";
    $arrContextOptions=array(
    "ssl"=>array(
    "verify_peer"=>false,
    "verify_peer_name"=>false,
    ),
    );
    $output = file_get_contents($url, true, stream_context_create($arrContextOptions));
    $json = json_decode($output, true);

    dd($json);
  2. sumardi created this gist Apr 21, 2017.
    5 changes: 5 additions & 0 deletions fetch_json_api.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    $url = urlencode ("http://domain/path/to/json");

    $json = json_decode(file_get_contents($url), true);

    dd($json);