title: Display JSON from external website scrape on a chart
body: <p>So I have been trying to scrape a websites data.asp file (which seems to be formatted in json) into my website to be displayed as a chart I seem to be able to get the json data but will not display as a chart in either googles chart API or fusioncharts I am not sure what I am doing wrong although in the examples on google and fusioncharts there json data is formatted differently would i have to change mine to meet that? and how would i do this to make sure that as the data.asp file is updated on the external website it is updated on mine also? </p>
  
  <p><strong>EDIT:</strong> Is there an easier way to get the data (aswell as on update) into a chart?
                  
          
            </p>
  
  <pre><code>        &lt;meta charset="utf-8"&gt;
          &lt;title&gt;Olympic Results&lt;/title&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
          &lt;meta name="description" content=""&gt;
          &lt;meta name="author" content=""&gt;
  
          &lt;!--styles --&gt;
          &lt;link href="css/bootstrap.css" rel="stylesheet"&gt;
          &lt;style type="text/css"&gt;
            body {
              padding-top: 60px;
              padding-bottom: 40px;
            }
            .sidebar-nav {
              padding: 9px 0;
            }
          &lt;/style&gt;
          &lt;link href="css/bootstrap-responsive.css" rel="stylesheet"&gt;
  
          &lt;!--HTML5 shim, for IE6-8 support of HTML5 elements --&gt;
          &lt;!--[if lt IE 9]&gt;
            &lt;script src="http://html5shim.googlecode.com/svn/trunk/html5.js"&gt;&lt;/script&gt;
          &lt;![endif]--&gt;
  
          &lt;?php
              if(!function_exists("curl_init")) die("cURL extension is not installed");
              $ch = curl_init("http://hosted.stats.com/olympics/medals_widget/data.asp?country=NZL");
              //Configuring curl options 
              $options=array(CURLOPT_RETURNTRANSFER =&gt; true, 
                             CURLOPT_HTTPHEADER =&gt; array('Content-type: application/json'));
              //Setting curl options
              curl_setopt_array($ch, $options);
              $pageData = curl_exec($ch);
              curl_close($ch); 
              //Cache the channel file 
              $cache_expire = 60*60*24*365;
              header("Pragma: public");
              header("Cache-Control: max-age=".$cache_expire);
              header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$cache_expire) . ' GMT');
          ?&gt;
          &lt;script type="text/javascript" src="Charts/FusionCharts.js"&gt;&lt;/script&gt;
  
        &lt;/head&gt;
        &lt;body&gt;
          &lt;div class="navbar navbar-fixed-top"&gt;
            &lt;div class="navbar-inner"&gt;
              &lt;div class="container-fluid"&gt;
                &lt;a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"&gt;
                  &lt;span class="icon-bar"&gt;&lt;/span&gt;
                  &lt;span class="icon-bar"&gt;&lt;/span&gt;
                  &lt;span class="icon-bar"&gt;&lt;/span&gt;
                &lt;/a&gt;
                &lt;a class="brand" href="#"&gt;Olympic Results&lt;/a&gt;
  
                &lt;div class="nav-collapse"&gt;
                  &lt;ul class="nav"&gt;
                    &lt;li class="active"&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;&lt;!--/.nav-collapse --&gt;
  
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="container-fluid"&gt;
          &lt;div id="chartContainer"&gt;FusionCharts XT will load here!&lt;/div&gt;          
          &lt;script type="text/javascript"&gt;
  
          &lt;!--       
            var data = &lt;?php echo $pageData; ?&gt;;
            document.write(data);
            var myChart = new FusionCharts( "Charts/Column3D.swf", "myChartId", "400", "300", "0", "1" );
            myChart.setJSONData(data);
            myChart.render("chartContainer");
  
          // --&gt;     
          &lt;/script&gt; 
          &lt;?php echo("$pageData"); ?&gt;
              &lt;footer style="padding-top:100px;"&gt;
              &lt;hr&gt;
              &lt;p&gt;&amp;copy; Olympic Results 2012&lt;/p&gt;
              &lt;/footer&gt;
  
          &lt;/div&gt;&lt;!--/.fluid-container--&gt;
  
          &lt;!-- javascript --&gt;
          &lt;!-- Placed at the end of the document so the pages load faster --&gt;
          &lt;script src="js/jquery.js"&gt;&lt;/script&gt;
          &lt;script src="js/bootstrap-transition.js"&gt;&lt;/script&gt;
          &lt;script src="js/bootstrap-alert.js"&gt;&lt;/script&gt;
          &lt;script src="js/bootstrap-modal.js"&gt;&lt;/script&gt;
          &lt;script src="js/bootstrap-dropdown.js"&gt;&lt;/script&gt;
          &lt;script src="js/bootstrap-scrollspy.js"&gt;&lt;/script&gt;
          &lt;script src="js/bootstrap-tab.js"&gt;&lt;/script&gt;
          &lt;script src="js/bootstrap-tooltip.js"&gt;&lt;/script&gt;
          &lt;script src="js/bootstrap-popover.js"&gt;&lt;/script&gt;
          &lt;script src="js/bootstrap-button.js"&gt;&lt;/script&gt;
          &lt;script src="js/bootstrap-collapse.js"&gt;&lt;/script&gt;
          &lt;script src="js/bootstrap-carousel.js"&gt;&lt;/script&gt;
          &lt;script src="js/bootstrap-typeahead.js"&gt;&lt;/script&gt;
        &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>Forgot to add what the JSON looks like -</p>
  
  <pre><code>{"medals": { 
  "Archery":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze":       "0", "total": "0" }], 
  "Track &amp; Field":[ { "stats_id": "83", "gold": "0", "silver": "1", "bronze": "0", "total": "1" }], 
  "Badminton":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Basketball":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Beach Volleyball":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Boxing":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Diving":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Equestrian":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "1", "total": "1" }], 
  "Soccer":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Fencing":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Handball":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Field Hockey":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Judo":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Modern Pentathlon":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }],
  "Rowing":[ { "stats_id": "83", "gold": "3", "silver": "0", "bronze": "2", "total": "5" }],  
  "Sailing":[ { "stats_id": "83", "gold": "1", "silver": "1", "bronze": "0", "total": "2" }], 
  "Shooting":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Swimming":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Synchronized Swimming":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Tennis":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Taekwondo":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Triathlon":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Table Tennis":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Volleyball":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Weightlifting":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Water Polo":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Wrestling":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Cycling":[ { "stats_id": "83", "gold": "0", "silver": "1", "bronze": "2", "total": "3" }], 
  "Gymnastics":[ { "stats_id": "83", "gold": "0", "silver": "0", "bronze": "0", "total": "0" }], 
  "Canoe":[ { "stats_id": "83", "gold": "1", "silver": "0", "bronze": "0", "total": "1"     }] 
  }}
  </code></pre>