my curl function is not working for rest api call using xml.my code is this below



my curl function is not working for rest api call using xml.my code is this below



$mydata = $xml->addChild('MobileNo',$row['MobileNo']);
$mydata = $xml->addChild('Name',$row['Name']);
$mydata = $xml->addChild('Age',$row['Age']);
$mydata = $xml->addChild('Gender',$row['Gender']);
$mydata = $xml->addChild('HeightCm',$row['HeightCm']);
$mydata = $xml->addChild('WeightKg',$row['WeightKg']);
$mydata = $xml->addChild('MarritalStatus',$row['MarritalStatus']);
$mydata = $xml->addChild('DrikingStatus',$row['DrikingStatus']);
$mydata = $xml->addChild('ConsumesAlcohol',$row['ConsumesAlcohol']);
$mydata = $xml->addChild('Remarks',$row['Remarks']);
$mydata = $xml->addChild('Symptoms');
$mydata1 = $mydata->addChild('Symptom');


while($DataSMT= mysql_fetch_assoc($SelctSMT))
{
$mydata1->addChild('Name',$DataSMT['Symptons']);
$mydata1->addChild('Duration',$DataSMT['Duration']);
$mydata1->addChild('Location',$DataSMT['Location']);
$mydata1 = $mydata1->addChild('SubSymptoms');

$DataArr = explode(",",$DataSMT['question']);
$AnsArr = explode(",",$DataSMT['answer']);
foreach($DataArr as $k=>$v)
{
$mydata2 = $mydata1->addChild('SubSymptom');
$mydata2->addChild('SubSymptomQuery',$v);
$mydata2->addChild('Response',$AnsArr[$k]);
}

}
$mydata = $xml->addChild('MedicalHistory');
$mydata3 = $mydata->addChild('CronicIllness');
$mydata3->addChild('Asthma',$row['asthma']);
$mydata3->addChild('Allergy',$row['allergy']);
$mydata3->addChild('Cardiac',$row['cardiac_disease']);
$mydata3->addChild('HighBP',$row['high_bp']);
$mydata->addChild('Improvement',$row['improvement_status_from_prior_medication']);
$mydata->addChild('PriorSurgery',$row['prior_surgery']);
$mydata->addChild('PriorTreatment',$row['prior_treatment']);

$fp = fopen($row['id'].".xml","wb");
$xml = fwrite($fp,$xml->asXML());


i searched about this on almost every site but i am unable to find a pointed answer which can solve my problem.,., can who can help me .,., thanks.


No comments:

Post a Comment