PHP force download json

download, json, php

Solution

header('Content-disposition: attachment; filename=file.json');
header('Content-type: application/json');
echo $json;

Problem

Possible Duplicate: Forcing to download a file using PHP If I have a json in a variable, how can I force the download? (The file not exist). Thanks.

Original source

Related problems