xml - How to load a json file in php code to prepare it for HTTP POST? -


i have .json file on disk. load on php code can make http post request it.

i have done same xml :

$file = 'http://localhost/myserver/test.xml'; $xml_builder = simplexml_load_file($file)) 

then use $xml_builder variable send xml curl.

how can exactly same json ?

i think need like:

$variable = file_get_contents('http://example.com/data.json'); $decoded = json_decode($variable); 

you need decode because getting string in $variable , use want


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -