Revision: 54162
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 13, 2011 08:28 by inreflection7
Initial Code
/* PHP FILE - names 'example.php' */
<?php
$content = file_get_contents('http://site.to.json/');
echo $content;
?>
/* jQuery making the request */
$.getJSON('example.php', function(data){
var items = [];
$.each(data, function(key, val){
// do stuff with data
log('key: ' + key + '. value: ' + val);
});
});
Initial URL
Initial Description
Use PHP to get JSON 1) set the PHP to the URL of the JSON 2) echo a variable with the loaded data 3) use a request via jQuery to get the variable from PHP
Initial Title
JSON with a PHP proxy
Initial Tags
php, json
Initial Language
PHP