How to parse json (feed) from PHP
json, php
Solution
You first have to get the JSON data from the remote server ; not sure how you can do that, considering there seems to be an authentication mecanism in place, but maybe `file_get_contents` or `curl` could help.
Once you have that JSON string in a PHP variable, it's just a matter of calling `json_decode` on it, to get your data.
For instance :
$json = file_get_contents('http://produits-lemieux.com/json.txt');
// you can save $json to a file, if needed :
//file_put_contents('file/path/my-file.txt', $json);
$data = json_decode($json);
var_dump($data);
Will get you an output like this one :
object(stdClass)[1]
public 'Liste_des_produits1' =>
array
0 =>
object(stdClass)[2]
public 'Added_Time' => string '28-Sep-2009 16:35:03' (length=20)
public 'prod_ingredient' => string 'sgsdgds' (length=7)
public 'prod_danger' =>
array
0 => string 'sans danger pour xyz' (length=20)
....
Note I used the "not encrypted" version, because I have no idea what kind of API you need to use to access the crypted one (never used "zoho")
Problem
I have a json feed from zoho : here, you can acces the same file unencrypted here I like to be able to display and parse the data from that feed int html I have ask a similar question yesterday, but the solution was a javascript, and having java disable client side can lead to nothing to display... so i will go with php. I can parse a var but a feed ?.... Question #2. Is it possible to capture a json feed, and save it as file (for backup purpose), so i will acces that file if the site go down (small possibilites)