how to convert text file to json php code example
Example 1: convert text file to json php
<?php
header('Content-type: application/json');
echo json_encode( explode("\r\n",file_get_contents('data.txt')) );
?>
Example 2: how to make a json request in php
<?php
$jsonurl = "http://api.wipmania.com/json";
$json = file_get_contents($jsonurl);
var_dump(json_decode($json));
?>