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
Post a Comment