John Chase John Chase - 10 months ago 63
PHP Question

PHP to Return Raw JSON Data?

I've been working on an tool that displays information from an API using PHP. Up until now I've been trying to echo individual fields of information one at a time in order to format them. Now I'm curious is it possible for me to somehow return just the whole unparsed JSON return, by this I mean just the raw JSON as it it. Can I somehow call that into a PHP page?

Here's an example of the JSON I'm referring to..


If you just want to output the json from on your website, you can use:

header('Content-Type: application/json');
$url = "https:///someJsonUrl";
echo file_get_contents($url);