John Chase John Chase - 2 years ago 109
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..

Answer Source

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);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download