php - How to read XML data from api request -
i making call url : http://example.com/service.asmx/gettodaysdiscussionforum
xml data please see screenshot :
$response = file_get_contents('http://103.1.115.87:100/service.asmx/gettodaysdiscussionforum'); $response = new simplexmlelement($response); print_r($response);exit;
it display following output :
simplexmlelement object ( [table1] => array ( [0] => simplexmlelement object ( [id] => 1210 [title] => test discussion, dont reply [createddate] => 4/25/2014 10:42:49 [status] => not sent ) [1] => simplexmlelement object ( [id] => 1182 [title] => negotiation skills discussion [createddate] => 4/25/2014 7:47:51 [status] => not sent ) ) )
how can store each data in variables ?
i new xml reading in advance
$xml = simplexml_load_string($xmlstring); $json = json_encode($xml); $array = json_decode($json,true);
Comments
Post a Comment